bs58::encode

Trait EncodeTarget

Source
pub trait EncodeTarget {
    // Required method
    fn encode_with(
        &mut self,
        max_len: usize,
        f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>,
    ) -> Result<usize>;
}
Expand description

Represents a buffer that can be encoded into. See EncodeBuilder::onto and the provided implementations for more details.

Required Methods§

Source

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Encodes into this buffer, provides the maximum length for implementations that wish to preallocate space, along with a function that will encode ASCII bytes into the buffer and return the length written to it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EncodeTarget for str

Source§

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Source§

impl EncodeTarget for String

Source§

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Source§

impl EncodeTarget for Vec<u8>

Source§

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Source§

impl EncodeTarget for [u8]

Source§

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Source§

impl<T: EncodeTarget + ?Sized> EncodeTarget for &mut T

Source§

fn encode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>

Implementors§