Struct Multiport

Source
pub struct Multiport<T: Sync> { /* private fields */ }
Expand description

A multiport is a vector of independent ports (its channels) Multiports have special Lingua Franca syntax, similar to reactor banks.

Implementations§

Source§

impl<T: Sync> Multiport<T>

Source

pub fn len(&self) -> usize

Returns the number of channels.

Source

pub fn is_empty(&self) -> bool

Returns true if this multiport is empty.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Port<T>>

Iterate over the multiport and return mutable references to individual channels.

Source

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

Iterate over the channels of this multiport. Returns read-only references to individual ports.

Source

pub fn enumerate_set(&self) -> impl Iterator<Item = (usize, &Port<T>)>

Iterate over only those channels that are set (have a value). Returns a tuple with their index (not necessarily contiguous).

Source

pub fn iterate_set(&self) -> impl Iterator<Item = &Port<T>>

Iterate over only those channels that are set (have a value). The returned ports are not necessarily contiguous. See Self::enumerate_set to get access to their index.

Source

pub fn iterate_values(&self) -> impl Iterator<Item = T> + '_
where T: Copy,

Iterate over only those channels that are set (have a value), and return a copy of the value. The returned ports are not necessarily contiguous. See Self::enumerate_values to get access to their index.

Source

pub fn iterate_values_ref(&self) -> impl Iterator<Item = &T> + '_

Iterate over only those ports that are set (have a value), and return a reference to the value. The returned ports are not necessarily contiguous. See Self::enumerate_values to get access to their index.

Source

pub fn enumerate_values(&self) -> impl Iterator<Item = (usize, T)> + '_
where T: Copy,

Iterate over only those channels that are set (have a value), yielding a tuple with their index in the bank and a copy of the value.

Source

pub fn enumerate_values_ref(&self) -> impl Iterator<Item = (usize, &T)> + '_

Iterate over only those channels that are set (have a value), yielding a tuple with their index in the bank and a reference to the value.

Trait Implementations§

Source§

impl<T: Sync> Index<usize> for Multiport<T>

Source§

type Output = Port<T>

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Sync> IndexMut<usize> for Multiport<T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T: Sync> IntoIterator for &'a Multiport<T>

Source§

type Item = &'a Port<T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Port<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T: Sync> IntoIterator for &'a mut Multiport<T>

Source§

type Item = &'a mut Port<T>

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, Port<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Multiport<T>

§

impl<T> !RefUnwindSafe for Multiport<T>

§

impl<T> !Send for Multiport<T>

§

impl<T> !Sync for Multiport<T>

§

impl<T> Unpin for Multiport<T>

§

impl<T> !UnwindSafe for Multiport<T>

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.