Skip to main content

Slots

Struct Slots 

Source
pub struct Slots<T> { /* private fields */ }
Expand description

Channel bookkeeping without any output: first-free allocation and generations.

Implementations§

Source§

impl<T> Slots<T>

Source

pub fn insert(&mut self, value: T) -> Option<Channel>

FindFreeChannel: the lowest free index, or None when all 64 are in use.

Source

pub fn get(&self, c: Channel) -> Option<&T>

The value of a channel, or None when the handle is stale.

Source

pub fn get_mut(&mut self, c: Channel) -> Option<&mut T>

The value of a channel, to change it, or None when the handle is stale.

Source

pub fn remove(&mut self, c: Channel) -> Option<T>

Free a channel and return its value.

Source

pub fn iter(&self) -> impl Iterator<Item = (Channel, &T)>

The channels in use, with their values.

Source

pub fn len(&self) -> usize

The number of channels in use.

Source

pub fn is_empty(&self) -> bool

Whether no channel is in use.

Trait Implementations§

Source§

impl<T: Debug> Debug for Slots<T>

Source§

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

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

impl<T> Default for Slots<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Freeze for Slots<T>

§

impl<T> RefUnwindSafe for Slots<T>
where T: RefUnwindSafe,

§

impl<T> Send for Slots<T>
where T: Send,

§

impl<T> Sync for Slots<T>
where T: Sync,

§

impl<T> Unpin for Slots<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Slots<T>

§

impl<T> UnwindSafe for Slots<T>
where T: UnwindSafe,

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
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.