Skip to main content

FerroListExtensions

Struct FerroListExtensions 

Source
pub struct FerroListExtensions;
Expand description

Defines extension methods for working with FerroLists.

Implementations§

Source§

impl FerroListExtensions

Source

pub 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.

Source

pub 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.

Source

pub 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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.