pub struct EncodeBuilder<'a, I: AsRef<[u8]>> { /* fields omitted */ }
A builder for setting up the alphabet and output of a base58 encode.
Setup encoder for the given string using the given alphabet.
Preferably use bs58::encode
instead of this
directly.
Change the alphabet that will be used for encoding.
let input = [0x60, 0x65, 0xe7, 0x9b, 0xba, 0x2f, 0x78];
assert_eq!(
"he11owor1d",
bs58::encode(input)
.with_alphabet(bs58::alphabet::RIPPLE)
.into_string());
Encode into a new owned string.
let input = [0x04, 0x30, 0x5e, 0x2b, 0x24, 0x73, 0xf0, 0x58];
assert_eq!("he11owor1d", bs58::encode(input).into_string());
Encode into the given string, any existing data will be cleared.
If the given string does not have enough capacity for the encoded
version of the data it will be reallocated as necessary.
let input = [0x04, 0x30, 0x5e, 0x2b, 0x24, 0x73, 0xf0, 0x58];
let mut output = "goodbye world".to_owned();
bs58::encode(input).into(&mut output);
assert_eq!("he11owor1d", output);