pub struct ElementList<Key, Value> { /* private fields */ }
Expand description
A filterable, ordered element list.
This owns the data to create child elements, and will manage adding/removing them from the DOM as the filter requires.
The list is ordered by Key
.
Implementations§
Source§impl<Key, Value> ElementList<Key, Value>
impl<Key, Value> ElementList<Key, Value>
Sourcepub fn new<GenerateChild, ChildElem, ParentElem>(
root: ParentElem,
generate_child: GenerateChild,
initial: impl Iterator<Item = (Key, Value)>,
) -> Self
pub fn new<GenerateChild, ChildElem, ParentElem>( root: ParentElem, generate_child: GenerateChild, initial: impl Iterator<Item = (Key, Value)>, ) -> Self
Sourcepub fn insert(&mut self, key: Key, item: Value)
pub fn insert(&mut self, key: Key, item: Value)
Insert an item into the list. If an item exists at key
, it is
replaced.
Sourcepub fn pop(&mut self)
pub fn pop(&mut self)
Pop the last element from the list. If the list is empty, this has no effect.
Sourcepub fn remove(&mut self, key: &Key)
pub fn remove(&mut self, key: &Key)
Remove the item corresponding to key
. If the item is not in the list,
this has no effect.
Sourcepub fn filter(&mut self, f: impl 'static + Fn(&Value) -> ReadSignal<bool>)
pub fn filter(&mut self, f: impl 'static + Fn(&Value) -> ReadSignal<bool>)
Apply a filter to the list, replacing any existing filter.
Sourcepub fn retain(&mut self, f: impl Fn(&Value) -> bool)
pub fn retain(&mut self, f: impl Fn(&Value) -> bool)
Remove all items for which f
returns false
. Matching items that are
currently filtered out will still be removed.
Trait Implementations§
Source§impl<Key, T> DomElement for ElementList<Key, T>
impl<Key, T> DomElement for ElementList<Key, T>
Auto Trait Implementations§
impl<Key, Value> Freeze for ElementList<Key, Value>
impl<Key, Value> !RefUnwindSafe for ElementList<Key, Value>
impl<Key, Value> !Send for ElementList<Key, Value>
impl<Key, Value> !Sync for ElementList<Key, Value>
impl<Key, Value> Unpin for ElementList<Key, Value>
impl<Key, Value> !UnwindSafe for ElementList<Key, Value>
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