FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    CompositeDisposable

    struct · ferroui-reactive · v0.5.0

    struct CompositeDisposable
    

    A group of disposables that are disposed together (CompositeDisposable).

    Disposables compare by identity (Remove, Contains); a disposable added twice is held twice. A disposable added after the group was disposed is disposed at once. The group disposes its members outside of any borrow of its list, so that a member may add to or remove from the group while it is disposed. Above a thousand disposables, removals find a disposable through an index, as upstream switches to a dictionary; the members keep the order they were added in.

    View source

    Members

    new

    fn new() -> Rc<Self>
    

    An empty group.

    Source

    with_capacity

    fn with_capacity(capacity: usize) -> Rc<Self>
    

    An empty group with room for capacity disposables.

    Source

    from_disposables

    fn from_disposables(disposables: impl IntoIterator<Item = Rc<dyn IDisposable>>) -> Rc<Self>
    

    A group of the given disposables.

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of disposables in the group.

    Source

    add

    fn add(self: &Self, item: Rc<dyn IDisposable>)
    

    Adds a disposable; disposes it at once when the group has been disposed.

    Source

    remove

    fn remove(self: &Self, item: &Rc<dyn IDisposable>) -> bool
    

    Removes the disposable and disposes it; false when the group does not hold it.

    Source

    clear

    fn clear(self: &Self)
    

    Disposes the disposables and removes them, without disposing the group (Clear).

    Source

    contains

    fn contains(self: &Self, item: &Rc<dyn IDisposable>) -> bool
    

    Whether the group holds the disposable.

    Source

    to_vec

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

    The disposables of the group, in the order they were added (ToArray, the enumerator).

    Source

    copy_to

    fn copy_to(self: &Self, array: &mut [Option<Rc<dyn IDisposable>>], index: usize)
    

    Copies the disposables into array from index (CopyTo). Panics, where upstream throws ArgumentOutOfRangeException, when index is not in the array or the disposables do not fit; a disposed group copies nothing.

    Source

    is_read_only

    fn is_read_only(self: &Self) -> bool
    

    Whether the group is read-only (IsReadOnly): never.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • Default
    • IDisposable
    • ICancelable

    Availability

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