i_slint_core::model

Trait ModelExt

Source
pub trait ModelExt: Model {
    // Provided methods
    fn row_data_tracked(&self, row: usize) -> Option<Self::Data> { ... }
    fn map<F, U>(self, map_function: F) -> MapModel<Self, F>
       where Self: Sized + 'static,
             F: Fn(Self::Data) -> U + 'static { ... }
    fn filter<F>(self, filter_function: F) -> FilterModel<Self, F>
       where Self: Sized + 'static,
             F: Fn(&Self::Data) -> bool + 'static { ... }
    fn sort(self) -> SortModel<Self, AscendingSortHelper>
       where Self: Sized + 'static,
             Self::Data: Ord { ... }
    fn sort_by<F>(self, sort_function: F) -> SortModel<Self, F>
       where Self: Sized + 'static,
             F: FnMut(&Self::Data, &Self::Data) -> Ordering + 'static { ... }
    fn reverse(self) -> ReverseModel<Self>
       where Self: Sized + 'static { ... }
}
Expand description

Extension trait with extra methods implemented on types that implement Model

Provided Methods§

Source

fn row_data_tracked(&self, row: usize) -> Option<Self::Data>

Convenience function that calls ModelTracker::track_row_data_changes before returning Model::row_data.

Calling row_data(row) does not register the row as a dependency when calling it while evaluating a property binding. This function calls track_row_data_changes(row) on the self.model_tracker() to enable tracking.

Source

fn map<F, U>(self, map_function: F) -> MapModel<Self, F>
where Self: Sized + 'static, F: Fn(Self::Data) -> U + 'static,

Returns a new Model where all elements are mapped by the function map_function. This is a shortcut for MapModel::new().

Source

fn filter<F>(self, filter_function: F) -> FilterModel<Self, F>
where Self: Sized + 'static, F: Fn(&Self::Data) -> bool + 'static,

Returns a new Model where the elements are filtered by the function filter_function. This is a shortcut for FilterModel::new().

Source

fn sort(self) -> SortModel<Self, AscendingSortHelper>
where Self: Sized + 'static, Self::Data: Ord,

Returns a new Model where the elements are sorted ascending. This is a shortcut for SortModel::new_ascending().

Source

fn sort_by<F>(self, sort_function: F) -> SortModel<Self, F>
where Self: Sized + 'static, F: FnMut(&Self::Data, &Self::Data) -> Ordering + 'static,

Returns a new Model where the elements are sorted by the function sort_function. This is a shortcut for SortModel::new().

Source

fn reverse(self) -> ReverseModel<Self>
where Self: Sized + 'static,

Returns a new Model where the elements are reversed. This is a shortcut for ReverseModel::new().

Implementors§

Source§

impl<T: Model> ModelExt for T