CommandBarElementCollection
struct · ferroui-controls · v0.5.0
struct CommandBarElementCollection
The read-only, notifying collection of command bar elements that a
CommandBar exposes as VisiblePrimaryCommands and OverflowItems
(the read-only observable collection of the reference).
The collection is a reference object: the value is a shared handle, clones refer to the same collection and handles compare by identity. Only the command bar that owns it changes it. As an items source its elements that are controls are items boxed as controls, so that an items control presents them as their own containers.
Members
countis_emptygetsnapshotto_veccontainsindex_ofadd_collection_changedremove_collection_changedas_items_source
count
fn count(self: &Self) -> usize
The number of elements.
is_empty
fn is_empty(self: &Self) -> bool
Whether the collection has no elements.
get
fn get(self: &Self, index: usize) -> Rc<dyn ICommandBarElement>
The element at index. Panics if out of range.
snapshot
fn snapshot(self: &Self) -> Rc<Vec<Rc<dyn ICommandBarElement>>>
The elements as they are now. The snapshot shares storage with the collection until the collection changes.
to_vec
fn to_vec(self: &Self) -> Vec<Rc<dyn ICommandBarElement>>
A copy of the elements.
contains
fn contains(self: &Self, element: &Rc<dyn ICommandBarElement>) -> bool
Whether the collection contains element.
index_of
fn index_of(self: &Self, element: &Rc<dyn ICommandBarElement>) -> Option<usize>
The index of element, if the collection contains it.
add_collection_changed
fn add_collection_changed(self: &Self, handler: Rc<ferroui_base::collections::CollectionChangedHandler<std::rc::Rc<dyn ICommandBarElement>>>) -> u64
Subscribes to the changes of the collection. Returns the token for
remove_collection_changed.
remove_collection_changed
fn remove_collection_changed(self: &Self, token: u64) -> bool
Unsubscribes a handler.
as_items_source
fn as_items_source(self: &Self) -> ItemsSource
The collection as the source of the items of an items control.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherClonePartialEqDebugFrom<CommandBarElementCollection>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.