Struct uninit_tools::buffer::BufferRef[][src]

pub struct BufferRef<'buffer, T> { /* fields omitted */ }

A reference to a Buffer, which is meant be a subset of the functionality offered by the fully owned buffer.

For example, it neither allows reading from the unfilled region, nor swapping out the buffer pointed to, with anything else.

Implementations

impl<'buffer, T> BufferRef<'buffer, T>[src]

pub fn items_filled(&self) -> usize[src]

pub fn by_ref(&mut self) -> BufferRef<'_, T>[src]

Reborrow the inner buffer, getting a buffer reference with a shorter lifetime.

impl<'buffer, T> BufferRef<'buffer, T> where
    T: Initialize
[src]

pub fn remaining(&self) -> usize[src]

pub fn unfilled_parts(
    &mut self
) -> (&mut [T::Item], &mut [MaybeUninit<T::Item>])
[src]

pub unsafe fn unfilled_mut(&mut self) -> &mut [MaybeUninit<T::Item>]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Get a mutable and possibly-uninitialized reference to all of the buffer.

Safety

The caller must not allow safe code to de-initialize the resulting slice.

pub unsafe fn advance(&mut self, count: usize)[src]

Advance the counter of the number of items filled.

The number of items that are initialized is also updated accordingly, so that the number of items initialized is always greater than or equal to the number of items filled.

Safety

The caller must uphold the initialization invariant.

pub unsafe fn advance_all(&mut self)[src]

Advance the counter of the number of items filled, and the number of items initialized, to the end of the buffer.

Safety

The caller must uphold the initialization invariant.

pub fn revert_to_start(&mut self)[src]

pub fn fill_by_repeating(&mut self, item: T::Item) where
    T::Item: Copy
[src]

pub fn append(&mut self, slice: &[T::Item]) where
    T::Item: Copy
[src]

impl<T> BufferRef<'_, T> where
    T: Initialize<Item = u8>, 
[src]

pub fn fill_by_zeroing(&mut self)[src]

Auto Trait Implementations

impl<'buffer, T> RefUnwindSafe for BufferRef<'buffer, T> where
    T: RefUnwindSafe

impl<'buffer, T> Send for BufferRef<'buffer, T> where
    T: Send

impl<'buffer, T> Sync for BufferRef<'buffer, T> where
    T: Sync

impl<'buffer, T> Unpin for BufferRef<'buffer, T>

impl<'buffer, T> !UnwindSafe for BufferRef<'buffer, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.