pub struct IndexedFamily<'a, K = IndexKey, F = VarFamily> { /* private fields */ }Expand description
Indexed family: maps an IndexKey to a single-element Expr (a variable or a
parameter), tagged with the key type K its domain decodes to and the family
kind F.
You normally name this through the IndexedVar/IndexedParam aliases,
constructed by the indexed form of the variable!/param! macros.
When the domain is a contiguous integer range (or a Cartesian product of
ranges) the family is stored densely (see the internal Storage).
String, sparse, and filtered families fall back to a hash map.
Implementations§
Source§impl<'a, K, F> IndexedFamily<'a, K, F>
impl<'a, K, F> IndexedFamily<'a, K, F>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_dense(&self) -> bool
pub fn is_dense(&self) -> bool
Whether this family is stored densely (domain was a range or product of ranges).
pub fn iter(&self) -> impl Iterator<Item = (&IndexKey, &Expr<'a>)> + '_
pub fn get<Q: Into<IndexKey>>(&self, key: Q) -> Option<Expr<'a>>
Sourcepub fn at<const N: usize>(&self, coords: [usize; N]) -> Expr<'a>
pub fn at<const N: usize>(&self, coords: [usize; N]) -> Expr<'a>
Zero-allocation typed index by integer coordinates.
On a dense family this maps straight to a flat offset with no
IndexKey built. On a sparse family it falls back to building a key.
§Panics
Panics if the coordinates are out of range/not present.
Source§impl<'a, K: FromIndexKey, F> IndexedFamily<'a, K, F>
impl<'a, K: FromIndexKey, F> IndexedFamily<'a, K, F>
Trait Implementations§
Source§impl<'a, K, F> Clone for IndexedFamily<'a, K, F>
impl<'a, K, F> Clone for IndexedFamily<'a, K, F>
Source§impl<'a, K, F: Family> Debug for IndexedFamily<'a, K, F>
impl<'a, K, F: Family> Debug for IndexedFamily<'a, K, F>
Source§impl<'a, K, F> Index<&IndexKey> for IndexedFamily<'a, K, F>
impl<'a, K, F> Index<&IndexKey> for IndexedFamily<'a, K, F>
Auto Trait Implementations§
impl<'a, K = IndexKey, F = VarFamily> !RefUnwindSafe for IndexedFamily<'a, K, F>
impl<'a, K = IndexKey, F = VarFamily> !Send for IndexedFamily<'a, K, F>
impl<'a, K = IndexKey, F = VarFamily> !Sync for IndexedFamily<'a, K, F>
impl<'a, K = IndexKey, F = VarFamily> !UnwindSafe for IndexedFamily<'a, K, F>
impl<'a, K, F> Freeze for IndexedFamily<'a, K, F>
impl<'a, K, F> Unpin for IndexedFamily<'a, K, F>
impl<'a, K, F> UnsafeUnpin for IndexedFamily<'a, K, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more