pub struct ByteBuilder<T> { /* private fields */ }
Expand description
A dynamically created buffer for T
Implementations§
source§impl<T> ByteBuilder<T>
impl<T> ByteBuilder<T>
sourcepub fn new_fixed(size: NonZeroUsize) -> Self
pub fn new_fixed(size: NonZeroUsize) -> Self
Create a builder of fixed size
sourcepub fn fold<F, I>(self, l: I, f: F) -> Selfwhere
I: Iterator,
F: FnMut(Self, I::Item) -> Self,
pub fn fold<F, I>(self, l: I, f: F) -> Selfwhere I: Iterator, F: FnMut(Self, I::Item) -> Self,
fold over an iterator
sourcepub fn iter8<F, I>(self, l: I, f: F) -> Selfwhere
I: Iterator + ExactSizeIterator,
F: FnMut(Self, I::Item) -> Self,
pub fn iter8<F, I>(self, l: I, f: F) -> Selfwhere I: Iterator + ExactSizeIterator, F: FnMut(Self, I::Item) -> Self,
write an iterator of maximum 256 items using the closure F
note that the buffer contains a byte to represent the size of the list
sourcepub fn iter16<F, I>(self, l: I, f: F) -> Selfwhere
I: Iterator + ExactSizeIterator,
F: FnMut(Self, I::Item) -> Self,
pub fn iter16<F, I>(self, l: I, f: F) -> Selfwhere I: Iterator + ExactSizeIterator, F: FnMut(Self, I::Item) -> Self,
write an iterator of maximum 2^16 items using the closure F
note that the buffer contains 2 bytes to represent the size of the list
pub fn sub<F, U>(self, f: F) -> Selfwhere F: Fn(ByteBuilder<U>) -> ByteBuilder<U>,
sourcepub fn finalize_as_vec(self) -> Vec<u8>
pub fn finalize_as_vec(self) -> Vec<u8>
Finalize the buffer and return a fixed ByteArray of T
Trait Implementations§
source§impl<T: Clone> Clone for ByteBuilder<T>
impl<T: Clone> Clone for ByteBuilder<T>
source§fn clone(&self) -> ByteBuilder<T>
fn clone(&self) -> ByteBuilder<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more