This guide will help you get set up and ready to use the WalletD Rust Library. We'll cover how to install Rust, add WalletD to an existing Rust project, and get started with using its features.

Installing Rust

Rust can be installed by following the instructions on rust-lang.org, rustup.rs or your choice of package manager. Refer to the Rust book for more guidance on the installation. You can set up a new Rust project to try out WalletD or incorporate the walletd crate into your existing Rust project.

Install the WalletD Rust Library

It is recommended that the walletd crate be installed from the command-line in order to ensure you download the latest version of it.

Installing via the CLI (recommended)

cargo add walletd

Installing via the Cargo.toml file

Add the following line to your Cargo.toml file. Make sure you put it under the dependencies heading, then rebuild your project.

walletd = "0.1.0"

What's next?

Great, you're now set up with installing the WalletD Rust library. You are now ready to try it out and incorporate it.

Here are links to guides with code examples that will introduce you to different aspects of WalletD:

Notes on following the guides

In the Rust code in the guides, we use ? to handle errors. Most of the example code we provide can be put inside a main function that returns a Result that uses the walletd::Error type.


use walletd;

fn main -> Result<(), walletd::Error> {
  println!("Main function returning Result for WalletD guide examples");

Another way to handle errors returned by WalletD in Rust is to use unwrap(). Instances of ? in the examples can be replaced by .unwrap(). However, it's usually better to limit the use of unwrap() (which leads to an immediate panic if an error occurs) and instead use ?. You may want to handle the different errors returned by WalletD in different ways in your implementation, and ? enables this.