FerroListExtensions
struct · ferroui-base · v0.5.0
struct FerroListExtensions
Defines extension methods for working with FerroLists.
Members
for_each_item
fn for_each_item<T, L>(collection: &L, added: impl Fn(&T) -> () + 'static, removed: impl Fn(&T) -> () + 'static, reset: impl Fn() -> () + 'static, weak_subscription: bool) -> Rc<dyn IDisposable>
where T: Clone + 'static,
L: IFerroReadOnlyList<T> + WeakEventSender
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
added is called initially for each item in the collection and
subsequently for each item added to the collection; removed for
each item removed from the collection; reset when the collection is
reset. weak_subscription indicates if a weak subscription should be
used to track changes to the collection. Returns a disposable used to
terminate the subscription.
for_each_item_indexed
fn for_each_item_indexed<T, L>(collection: &L, added: impl Fn(usize, &T) -> () + 'static, removed: impl Fn(usize, &T) -> () + 'static, reset: impl Fn() -> () + 'static, weak_subscription: bool) -> Rc<dyn IDisposable>
where T: Clone + 'static,
L: IFerroReadOnlyList<T> + WeakEventSender
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
added is called initially for each item in the collection and
subsequently for each item added to the collection, with the index in
the collection and the item; removed for each item removed from the
collection, with the index in the collection and the item; reset
when the collection is reset, which is followed by calls to added
for each item present in the collection after the reset.
weak_subscription indicates if a weak subscription should be used to
track changes to the collection. Returns a disposable used to
terminate the subscription.
A weak subscription is held by the returned disposable: the collection holds the handler weakly, as the weak collection changed subscription of the original does, and the handler goes when the disposable is disposed or dropped.
track_item_property_changed
fn track_item_property_changed<T, L>(collection: &L, callback: impl Fn((Option<BoxedValue>, &str)) -> () + 'static) -> Rc<dyn IDisposable>
where T: Clone + PartialEq + 'static,
L: IFerroReadOnlyList<T> + WeakEventSender
Listens for property changed events from all items in a collection.
callback is called for each property changed event with the item
that raised it and the name of the property. An item raises property
changed events if its model type declares them
(ModelTypes); an item that is a shared model object (Rc<M> of a
registered model type M, or a boxed value) is the object itself.
Returns a disposable used to terminate the subscription.
Panics
The subscription panics when the collection is reset, as the original throws.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.