Struct cardano_serialization_lib::typed_bytes::ByteBuilder
source · [−]pub struct ByteBuilder<T> { /* private fields */ }
Expand description
A dynamically created buffer for T
Implementations
sourceimpl<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) -> Self where
I: Iterator,
F: FnMut(Self, I::Item) -> Self,
pub fn fold<F, I>(self, l: I, f: F) -> Self where
I: Iterator,
F: FnMut(Self, I::Item) -> Self,
fold over an iterator
sourcepub fn iter8<F, I>(self, l: I, f: F) -> Self where
I: Iterator + ExactSizeIterator,
F: FnMut(Self, I::Item) -> Self,
pub fn iter8<F, I>(self, l: I, f: F) -> Self where
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) -> Self where
I: Iterator + ExactSizeIterator,
F: FnMut(Self, I::Item) -> Self,
pub fn iter16<F, I>(self, l: I, f: F) -> Self where
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) -> Self where
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
sourceimpl<T: Clone> Clone for ByteBuilder<T>
impl<T: Clone> Clone for ByteBuilder<T>
sourcefn clone(&self) -> ByteBuilder<T>
fn clone(&self) -> ByteBuilder<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> From<ByteBuilder<T>> for Vec<u8>
impl<T> From<ByteBuilder<T>> for Vec<u8>
sourcefn from(bb: ByteBuilder<T>) -> Vec<u8>
fn from(bb: ByteBuilder<T>) -> Vec<u8>
Converts to this type from the input type.
Auto Trait Implementations
impl<T> RefUnwindSafe for ByteBuilder<T> where
T: RefUnwindSafe,
impl<T> Send for ByteBuilder<T> where
T: Send,
impl<T> Sync for ByteBuilder<T> where
T: Sync,
impl<T> Unpin for ByteBuilder<T> where
T: Unpin,
impl<T> UnwindSafe for ByteBuilder<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more