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.
Members
new
fn new() -> Rc<Self>
An empty group.
with_capacity
fn with_capacity(capacity: usize) -> Rc<Self>
An empty group with room for capacity disposables.
from_disposables
fn from_disposables(disposables: impl IntoIterator<Item = Rc<dyn IDisposable>>) -> Rc<Self>
A group of the given disposables.
count
fn count(self: &Self) -> usize
The number of disposables in the group.
add
fn add(self: &Self, item: Rc<dyn IDisposable>)
Adds a disposable; disposes it at once when the group has been disposed.
remove
fn remove(self: &Self, item: &Rc<dyn IDisposable>) -> bool
Removes the disposable and disposes it; false when the group does not hold it.
clear
fn clear(self: &Self)
Disposes the disposables and removes them, without disposing the group (Clear).
contains
fn contains(self: &Self, item: &Rc<dyn IDisposable>) -> bool
Whether the group holds the disposable.
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).
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.
is_read_only
fn is_read_only(self: &Self) -> bool
Whether the group is read-only (IsReadOnly): never.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyDefaultIDisposableICancelable
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.