pub struct SharedAnyViews<V>(/* private fields */);Expand description
A reference-counted, type-erased container for Views collections.
SharedAnyViews allows multiple owners to share access
to the same views collection through reference counting.
Implementations§
Sourcepub fn new(contents: impl Views<View = V> + 'static) -> Self
pub fn new(contents: impl Views<View = V> + 'static) -> Self
Creates a new type-erased shared view collection from any type implementing the Views trait.
This function wraps the provided collection in a type-erased container using reference counting, allowing different view collection implementations to be used through a common interface with shared ownership.
§Parameters
contents- Any collection implementing theViewstrait with the appropriate item type
§Returns
A new SharedAnyViews instance containing the provided collection
Trait Implementations§
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§
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