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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 272 bytes