Struct bs58::encode::EncodeBuilder[][src]

pub struct EncodeBuilder<'a, I: AsRef<[u8]>> { /* fields omitted */ }

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

Methods

impl<'a, I: AsRef<[u8]>> EncodeBuilder<'a, I>
[src]

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.

Examples

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.

Examples

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.

Examples

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);

Auto Trait Implementations

impl<'a, I> Send for EncodeBuilder<'a, I> where
    I: Send

impl<'a, I> Sync for EncodeBuilder<'a, I> where
    I: Sync