ItemsSourceView
struct · ferroui-controls · v0.5.0
struct ItemsSourceView
Represents a standardized view of the supported interactions between an items collection and an items control.
Members
emptynewcounthas_key_index_mappingkey_from_indexindex_from_keysourceadd_collection_changedremove_collection_changedget_atcontainsindex_ofget_or_createget_or_create_ofiterto_vec
empty
fn empty() -> Rc<ItemsSourceView>
Gets an empty ItemsSourceView.
new
fn new(source: ItemsSource) -> Rc<Self>
Initializes a new instance of the view for the specified data source.
count
fn count(self: &Self) -> usize
Gets the number of items in the collection.
has_key_index_mapping
fn has_key_index_mapping(self: &Self) -> bool
Gets a value that indicates whether the items source can provide a unique key for
each item: whether the source implements IKeyIndexMapping
(WinUI ItemsSourceView.HasKeyIndexMapping).
key_from_index
fn key_from_index(self: &Self, index: i32) -> String
Retrieves the unique key of the item at index from the items source
(WinUI ItemsSourceView.KeyFromIndex).
Panics if the source does not implement IKeyIndexMapping
(WinUI throws hresult_not_implemented), or if index is not the index of an item.
index_from_key
fn index_from_key(self: &Self, key: &str) -> i32
Retrieves the index of the item that has the unique key key, or -1 when no item
has it (WinUI ItemsSourceView.IndexFromKey).
Panics if the source does not implement IKeyIndexMapping
(WinUI throws hresult_not_implemented).
source
fn source(self: &Self) -> ItemsSource
Gets the source collection.
add_collection_changed
fn add_collection_changed(self: &Self, handler: Rc<ItemsChangedHandler>) -> u64
Occurs when the collection has changed to indicate the reason for
the change and which items changed. Returns the token for
remove_collection_changed.
remove_collection_changed
fn remove_collection_changed(self: &Self, token: u64)
get_at
fn get_at(self: &Self, index: usize) -> Option<BoxedValue>
Retrieves the item at the specified index. Panics if out of range.
contains
fn contains(self: &Self, item: &Option<BoxedValue>) -> bool
Whether the collection contains the item.
index_of
fn index_of(self: &Self, item: &Option<BoxedValue>) -> i32
The index of the item, or -1.
get_or_create
fn get_or_create(items: Option<&ItemsSource>) -> Rc<ItemsSourceView>
Gets or creates an ItemsSourceView for the specified source.
Returns empty if items is None, the view itself if items
is a view (ItemsSourceView isv => isv), otherwise a new view.
get_or_create_of
fn get_or_create_of<T: PropertyValue>(items: Option<&ItemsSource>) -> ItemsSourceViewOf<T>
Gets or creates a typed view for the specified source.
iter
fn iter(self: &Self) -> impl Iterator<Item = Option<BoxedValue>>
The items, enumerated by index over the live collection.
to_vec
fn to_vec(self: &Self) -> Vec<Option<BoxedValue>>
A copy of the items.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherMarkupTypedPartialEqIItemsListIKeyIndexMappingICollectionChangedListener
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.