BytesBuilder

Struct BytesBuilder 

Source
pub struct BytesBuilder<'a, TBytes: BytesType> { /* private fields */ }

Implementations§

Source§

impl<'a, TBytes: BytesType> BytesBuilder<'a, TBytes>

Source

pub fn build( build: impl Fn(&mut BytesBuilder<'a, TBytes>), ) -> Result<TBytes, TryReserveError>

Source

pub fn len(&self) -> usize

Gets the current length of the builder.

On the first pass this will be the current calculated capacity and on the second pass it will be the current length of the bytes.

Source

pub fn append(&mut self, value: impl BytesAppendable<'a> + 'a)

Source

pub fn append_be<T: EndianBytesAppendable + 'a>(&mut self, value: T)

Appends a number in big-endian byte order.

WARNING: Rust defaults to i32 for integer literals. It’s probably best to always specify the type of number.

Source

pub fn append_le<T: EndianBytesAppendable + 'a>(&mut self, value: T)

Appends a number in little-endian byte order.

WARNING: Rust defaults to i32 for integer literals. It’s probably best to always specify the type of number.

Auto Trait Implementations§

§

impl<'a, TBytes> Freeze for BytesBuilder<'a, TBytes>

§

impl<'a, TBytes> RefUnwindSafe for BytesBuilder<'a, TBytes>
where <TBytes as BytesType>::MutType: RefUnwindSafe,

§

impl<'a, TBytes> Send for BytesBuilder<'a, TBytes>
where <TBytes as BytesType>::MutType: Send,

§

impl<'a, TBytes> Sync for BytesBuilder<'a, TBytes>
where <TBytes as BytesType>::MutType: Sync,

§

impl<'a, TBytes> Unpin for BytesBuilder<'a, TBytes>

§

impl<'a, TBytes> !UnwindSafe for BytesBuilder<'a, TBytes>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.