Struct BlockSize

Source
pub struct BlockSize<const L: usize, const F: usize>;
Expand description

Custom Block Size

In channels, items are stored in contiguous blocks (chunks) of item slots. New blocks are allocated as items are sent through the channel. A large block size will result in less but bigger allocations. A small block size will result in more, smaller allocations. For channels transporting large amounts of items, a large block size is preferred. This structure allows you to create channels with custom block size (chunk length).

See the following pre-defined block sizes:

L must be equal to F x 8

Implementations§

Source§

impl<const L: usize, const F: usize> BlockSize<L, F>

Source

pub fn fifo<T>() -> Fifo<L, F, T>

Source

pub fn arc_fifo<T: 'static>() -> Arc<dyn FifoApi<T>>

Source§

impl<const L: usize, const F: usize> BlockSize<L, F>

Source

pub fn non_blocking<T: 'static>() -> (Producer<T>, Consumer<T>)

Source§

impl<const L: usize, const F: usize> BlockSize<L, F>

Source

pub fn channel<T: 'static>() -> (Sender<T>, Receiver<T>)

Trait Implementations§

Source§

impl<const L: usize, const F: usize> Default for BlockSize<L, F>

Source§

fn default() -> BlockSize<L, F>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const L: usize, const F: usize> Freeze for BlockSize<L, F>

§

impl<const L: usize, const F: usize> RefUnwindSafe for BlockSize<L, F>

§

impl<const L: usize, const F: usize> Send for BlockSize<L, F>

§

impl<const L: usize, const F: usize> Sync for BlockSize<L, F>

§

impl<const L: usize, const F: usize> Unpin for BlockSize<L, F>

§

impl<const L: usize, const F: usize> UnwindSafe for BlockSize<L, F>

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.