pub struct DecodeBuilder<'a, I: AsRef<[u8]>> { /* private fields */ }
Expand description

A builder for setting up the alphabet and output of a base58 decode.

See the documentation for bs58::decode for a more high level view of how to use this.

Implementations

Setup decoder for the given string using the given alphabet. Preferably use bs58::decode instead of this directly.

Change the alphabet that will be used for decoding.

Examples
assert_eq!(
    vec![0x60, 0x65, 0xe7, 0x9b, 0xba, 0x2f, 0x78],
    bs58::decode("he11owor1d")
        .with_alphabet(bs58::Alphabet::RIPPLE)
        .into_vec()?);

Decode into a new vector of bytes.

See the documentation for bs58::decode for an explanation of the errors that may occur.

Examples
assert_eq!(
    vec![0x04, 0x30, 0x5e, 0x2b, 0x24, 0x73, 0xf0, 0x58],
    bs58::decode("he11owor1d").into_vec()?);

Decode into the given buffer.

Returns the length written into the buffer, the rest of the bytes in the buffer will be untouched.

See the documentation for bs58::decode for an explanation of the errors that may occur.

Examples
let mut output = [0xFF; 10];
assert_eq!(8, bs58::decode("he11owor1d").into(&mut output)?);
assert_eq!(
    [0x04, 0x30, 0x5e, 0x2b, 0x24, 0x73, 0xf0, 0x58, 0xFF, 0xFF],
    output);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.