pub struct Encoder { /* private fields */ }Expand description
Stateful standard basE91 encoder.
A call to finish ends the current message and consumes the
encoder, so the same stream cannot be continued afterwards. Separately
finished messages must not be concatenated and treated as one basE91 stream.
The consuming contract is enforced by the type system: the encoder is not
Copy, so reusing it after finish fails to compile.
ⓘ
use fastbase91_core::Encoder;
let mut encoder = Encoder::new();
let mut output = [0_u8; 4];
let _tail = encoder.finish();
// `finish` consumed the encoder; encoding more must not compile.
let _ = encoder.update(b"x", &mut output);Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn update(
&mut self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, OutputTooSmall>
pub fn update( &mut self, input: &[u8], output: &mut [u8], ) -> Result<usize, OutputTooSmall>
Encodes a chunk into caller-provided storage.
If the output is too small, neither the encoder state nor the output slice is changed. Capacity is checked using a content-independent upper bound derived from the current bit count and the input length.
Trait Implementations§
impl Eq for Encoder
impl StructuralPartialEq for Encoder
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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