Struct silkenweb::element_list::ElementList [−][src]
pub struct ElementList<Key, Value> { /* fields omitted */ }
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
impl<Key, Value> ElementList<Key, Value> where
Key: 'static + Clone + Ord + Eq,
Value: 'static,
[src]
impl<Key, Value> ElementList<Key, Value> where
Key: 'static + Clone + Ord + Eq,
Value: 'static,
[src]pub fn new<GenerateChild, ChildElem, ParentElem>(
root: ParentElem,
generate_child: GenerateChild,
initial: impl Iterator<Item = (Key, Value)>
) -> ElementList<Key, Value> where
GenerateChild: 'static + Fn(&Value) -> ChildElem,
ChildElem: Into<Element>,
ParentElem: Into<ElementBuilder>,
[src]
root: ParentElem,
generate_child: GenerateChild,
initial: impl Iterator<Item = (Key, Value)>
) -> ElementList<Key, Value> where
GenerateChild: 'static + Fn(&Value) -> ChildElem,
ChildElem: Into<Element>,
ParentElem: Into<ElementBuilder>,
pub fn is_empty(&self) -> bool
[src]
true
iff the list, without a filter applied, is empty.
pub fn len(&self) -> usize
[src]
The length of the list without any filter applied.
pub fn insert(&mut self, key: Key, item: Value)
[src]
Insert an item into the list. If an item exists at key
, it is
replaced.
pub fn pop(&mut self)
[src]
Pop the last element from the list. If the list is empty, this has no effect.
pub fn remove(&mut self, key: &Key)
[src]
Remove the item corresponding to key
. If the item is not in the list,
this has no effect.
pub fn filter(&mut self, f: impl Fn(&Value) -> ReadSignal<bool> + 'static)
[src]
Apply a filter to the list, replacing any existing filter.
pub fn retain(&mut self, f: impl Fn(&Value) -> bool)
[src]
Remove all items for which f
returns false
. Matching items that are
currently filtered out will still be removed.
pub fn values(&mut self) -> impl Iterator<Item = Ref<'_, Value>>
[src]
An iterator over all values in the list, including hidden items. If
Value
is interiorly mutable and reactivity with the filter
is correctly set up, it’s safe to mutate the items.
pub fn clear(&mut self)
[src]
Clear all the items from the list, including filtered items.
Trait Implementations
impl<Key, T> DomElement for ElementList<Key, T>
[src]
impl<Key, T> DomElement for ElementList<Key, T>
[src]type Target = Element
pub fn dom_element(&self) -> <ElementList<Key, T> as DomElement>::Target
[src]
Auto Trait Implementations
impl<Key, Value> !RefUnwindSafe for ElementList<Key, Value>
impl<Key, Value> !RefUnwindSafe for ElementList<Key, Value>
impl<Key, Value> !Send for ElementList<Key, Value>
impl<Key, Value> !Send for ElementList<Key, Value>
impl<Key, Value> !Sync for ElementList<Key, Value>
impl<Key, Value> !Sync for ElementList<Key, Value>
impl<Key, Value> Unpin for ElementList<Key, Value>
impl<Key, Value> Unpin for ElementList<Key, Value>
impl<Key, Value> !UnwindSafe for ElementList<Key, Value>
impl<Key, Value> !UnwindSafe for ElementList<Key, Value>