FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    count

    fn count(self: &Self) -> usize
    

    The number of elements.

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Whether the collection has no elements.

    Source

    get

    fn get(self: &Self, index: usize) -> Rc<dyn ICommandBarElement>
    

    The element at index. Panics if out of range.

    Source

    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.

    Source

    to_vec

    fn to_vec(self: &Self) -> Vec<Rc<dyn ICommandBarElement>>
    

    A copy of the elements.

    Source

    contains

    fn contains(self: &Self, element: &Rc<dyn ICommandBarElement>) -> bool
    

    Whether the collection contains element.

    Source

    index_of

    fn index_of(self: &Self, element: &Rc<dyn ICommandBarElement>) -> Option<usize>
    

    The index of element, if the collection contains it.

    Source

    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.

    Source

    remove_collection_changed

    fn remove_collection_changed(self: &Self, token: u64) -> bool
    

    Unsubscribes a handler.

    Source

    as_items_source

    fn as_items_source(self: &Self) -> ItemsSource
    

    The collection as the source of the items of an items control.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone
    • PartialEq
    • Debug
    • From<CommandBarElementCollection>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.