pub struct Constant<C>{ /* private fields */ }Expand description
A statically sized collection that never changes, removes, or adds items.
Constant wraps a collection and provides a stable view collection where
elements are identified by their index position. This is useful for static
lists of views that don’t need to be updated or reordered.
Implementations§
Trait Implementations§
Source§impl<C> Collection for Constant<C>
impl<C> Collection for Constant<C>
Source§fn get(&self, index: usize) -> Option<Self::Item>
fn get(&self, index: usize) -> Option<Self::Item>
Gets an item from the collection at the specified index.
Source§impl<V> Views for Constant<V>
impl<V> Views for Constant<V>
Source§type Id = SelfId<usize>
type Id = SelfId<usize>
The type of unique identifier for items in the collection.
Must implement
Hash and Ord to ensure uniqueness and ordering.Source§type View = <V as Collection>::Item
type View = <V as Collection>::Item
The view type that this collection produces for each element.
Source§fn get_id(&self, index: usize) -> Option<Self::Id>
fn get_id(&self, index: usize) -> Option<Self::Id>
Returns the unique identifier for the item at the specified index, or
None if out of bounds.Source§fn get_view(&self, index: usize) -> Option<Self::View>
fn get_view(&self, index: usize) -> Option<Self::View>
Returns the view at the specified index, or
None if the index is out of bounds.Auto Trait Implementations§
impl<C> Freeze for Constant<C>where
C: Freeze,
impl<C> RefUnwindSafe for Constant<C>where
C: RefUnwindSafe,
impl<C> Send for Constant<C>where
C: Send,
impl<C> Sync for Constant<C>where
C: Sync,
impl<C> Unpin for Constant<C>where
C: Unpin,
impl<C> UnwindSafe for Constant<C>where
C: UnwindSafe,
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
Mutably borrows from an owned value. Read more