Trait Drain

Source
pub unsafe trait Drain: Buffer {
    type Value;

    // Required method
    unsafe fn remove(&mut self, index: usize) -> Self::Value;
}
Expand description

Buffer whose values can be drained from.

§Safety

Calling Drain::remove remove the value inserted at index index (see [InsertIntoBuffer::insert_into`])

Required Associated Types§

Source

type Value

Value to be removed from the buffer

Required Methods§

Source

unsafe fn remove(&mut self, index: usize) -> Self::Value

Removes a value from the buffer at a given index and return it.

§Safety

A value must have been inserted at this index (see InsertIntoBuffer::insert_into) before calling this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Drain for WriteVectoredVecBuffer<T>
where T: AsRef<[u8]>,

Available on crate features write and std only.
Source§

type Value = T

Source§

impl<T> Drain for VecBuffer<T>

Available on crate feature alloc only.
Source§

type Value = T

Source§

impl<T, const N: usize> Drain for WriteVectoredArrayBuffer<T, N>
where T: AsRef<[u8]>,

Available on crate features write and std only.
Source§

type Value = T

Source§

impl<T, const N: usize> Drain for ArrayBuffer<T, N>

Source§

type Value = T