pub struct AnyViews<V>(/* private fields */);Expand description
A type-erased container for Views collections.
AnyViews provides a uniform interface to different views collections
by wrapping them in a type-erased container. This enables working with
heterogeneous view collections through a common interface.
Implementations§
Source§impl<V> AnyViews<V>where
V: View,
impl<V> AnyViews<V>where
V: View,
Sourcepub fn new<C>(contents: C) -> Selfwhere
C: Views<View = V> + 'static,
pub fn new<C>(contents: C) -> Selfwhere
C: Views<View = V> + 'static,
Creates a new type-erased view collection from any type implementing the Views trait.
This function wraps the provided collection in a type-erased container, allowing different view collection implementations to be used through a common interface.
§Parameters
contents- Any collection implementing theViewstrait with the appropriate item type
§Returns
A new AnyViews instance containing the provided collection
Trait Implementations§
Source§impl<V> Views for AnyViews<V>where
V: View,
impl<V> Views for AnyViews<V>where
V: View,
Source§type Id = SelfId<Id>
type Id = SelfId<Id>
The type of unique identifier for items in the collection.
Must implement
Hash and Ord to ensure uniqueness and ordering.Source§type Guard = Box<dyn WatcherGuard>
type Guard = Box<dyn WatcherGuard>
The type of guard returned when registering a watcher.
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<V> Freeze for AnyViews<V>
impl<V> !RefUnwindSafe for AnyViews<V>
impl<V> !Send for AnyViews<V>
impl<V> !Sync for AnyViews<V>
impl<V> Unpin for AnyViews<V>
impl<V> !UnwindSafe for AnyViews<V>
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