I'm writing a code that converts an array/slice/vector to a B58-encoded string with the check. Here is the relevant code excerpt:
use bs58;
i = b"Hello"; // or
i = [0,1,2,3]; // or
i = vec![0,1,2,3];
let e = bs58::encode(i).with_check().into_string();
No matter what type I supply to bs58::encode(), it errors out saying that method with_check() not found. Coming from Python, it's really frustrating because I have to spend hours debugging simple stuff that should just work.
If you look in the API documentation for bs58::encode, you see that it returns a EncodeBuilder.
Looking at the documentation for that, you see that there is a
with_checkmethod but it has a note attached to it:Rust supports crates defining optional features - these features typically have extra dependancies that are not needed in all cases, so they are off by default.
You can enable the extra features in your
Cargo.tomlfile, like this:See also the Features section of the Cargo book.