Struct data_encoding::Encoder
source · pub struct Encoder<'a> { /* private fields */ }
Available on crate feature
alloc
only.Expand description
Encodes fragmented input to an output
It is equivalent to use an Encoder
with multiple calls to Encoder::append()
than to
first concatenate all the input and then use Encoding::encode_append()
. In particular, this
function will not introduce padding or wrapping between inputs.
§Examples
// This is a bit inconvenient but we can't take a long-term reference to data_encoding::BASE64
// because it's a constant. We need to use a static which has an address instead. This will be
// fixed in version 3 of the library.
static BASE64: data_encoding::Encoding = data_encoding::BASE64;
let mut output = String::new();
let mut encoder = BASE64.new_encoder(&mut output);
encoder.append(b"hello");
encoder.append(b"world");
encoder.finalize();
assert_eq!(output, BASE64.encode(b"helloworld"));
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Encoder<'a>
impl<'a> RefUnwindSafe for Encoder<'a>
impl<'a> Send for Encoder<'a>
impl<'a> Sync for Encoder<'a>
impl<'a> Unpin for Encoder<'a>
impl<'a> !UnwindSafe for Encoder<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more