Skip to main content

Buffers

Trait Buffers 

Source
pub trait Buffers<T>
where T: ?Sized,
{ type Buffer<'a>: DerefMut<Target = T> where Self: 'a; // Required methods async fn get(&self) -> Option<Self::Buffer<'_>>; fn get_immediate(&self) -> Option<Self::Buffer<'_>>; }
Expand description

A trait for getting access to a &mut T buffer, potentially awaiting until a buffer becomes available.

Required Associated Types§

Source

type Buffer<'a>: DerefMut<Target = T> where Self: 'a

Required Methods§

Source

async fn get(&self) -> Option<Self::Buffer<'_>>

Get a reference to a buffer. Might await until a buffer is available, as it might be in use by somebody else.

Depending on its internal implementation details, access to a buffer might also be denied immediately, or after a certain amount of time (subject to the concrete implementation of the method). In that case, the method will return None.

Source

fn get_immediate(&self) -> Option<Self::Buffer<'_>>

Get a reference to a buffer immediately, without waiting. If no buffer is available, return None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<B, T> Buffers<T> for &B
where B: Buffers<T>, T: ?Sized,

Source§

type Buffer<'a> = <B as Buffers<T>>::Buffer<'a> where &B: 'a

Source§

fn get(&self) -> impl Future<Output = Option<<&B as Buffers<T>>::Buffer<'_>>>

Source§

fn get_immediate(&self) -> Option<<&B as Buffers<T>>::Buffer<'_>>

Implementors§

Source§

impl<T, const N: usize, M> Buffers<T> for PooledBuffers<T, N, M>
where T: InitDefault, M: RawMutex,

Source§

type Buffer<'b> = PooledBuffer<'b, T, N, M> where PooledBuffers<T, N, M>: 'b

Source§

impl<const N: usize> Buffers<[u8]> for PacketBufferExternalAccess<'_, N>