Struct FixedBuffer

Source
pub struct FixedBuffer<N: ArrayLength<u8>> { /* private fields */ }

Implementations§

Source§

impl<N: ArrayLength<u8>> FixedBuffer<N>

Source

pub fn new() -> Self

Create a new buffer

Trait Implementations§

Source§

impl<N: ArrayLength<u8>> Clone for FixedBuffer<N>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N: ArrayLength<u8>> Debug for FixedBuffer<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<N: ArrayLength<u8>> FixedBuf for FixedBuffer<N>

Source§

fn input<F: FnMut(&[u8])>(&mut self, input: &[u8], func: F)

Input a vector of bytes. If the buffer becomes full, process it with the provided function and then clear the buffer.
Source§

fn reset(&mut self)

Reset the buffer.
Source§

fn zero_until(&mut self, idx: usize)

Zero the buffer up until the specified index. The buffer position currently must not be greater than that index.
Source§

fn next(&mut self, len: usize) -> &mut [u8]

Get a slice of the buffer of the specified size. There must be at least that many bytes remaining in the buffer.
Source§

fn full_buffer(&mut self) -> &mut [u8]

Get the current buffer. The buffer must already be full. This clears the buffer as well.
Source§

fn current_buffer(&self) -> &[u8]

Get the current buffer.
Source§

fn position(&self) -> usize

Get the current position of the buffer.
Source§

fn remaining(&self) -> usize

Get the number of bytes remaining in the buffer until it is full.
Source§

fn size() -> usize

Get the size of the buffer

Auto Trait Implementations§

§

impl<N> Freeze for FixedBuffer<N>
where <N as ArrayLength<u8>>::ArrayType: Freeze,

§

impl<N> RefUnwindSafe for FixedBuffer<N>

§

impl<N> Send for FixedBuffer<N>
where <N as ArrayLength<u8>>::ArrayType: Send,

§

impl<N> Sync for FixedBuffer<N>
where <N as ArrayLength<u8>>::ArrayType: Sync,

§

impl<N> Unpin for FixedBuffer<N>
where <N as ArrayLength<u8>>::ArrayType: Unpin,

§

impl<N> UnwindSafe for FixedBuffer<N>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StandardPadding for T
where T: FixedBuf,

Source§

fn pad<F>(&mut self, padding: u8, rem: usize, func: F)
where F: FnMut(&[u8]),

Add standard padding to the buffer. The buffer must not be full when this method is called and is guaranteed to have exactly rem remaining bytes when it returns. If there are not at least rem bytes available, the buffer will be zero padded, processed, cleared, and then filled with zeros again until only rem bytes are remaining.
Source§

fn standard_padding<F: FnMut(&[u8])>(&mut self, rem: usize, func: F)

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.