ListObservable
struct · ferroui-reactive · v0.5.0
struct ListObservable<T>
The values of a sequence as a list, once the sequence has ended (ListObservable<T>), and the
sequence of its end.
The list subscribes to the source when it is made, and keeps its values; the list can then be read and changed as a list once the source has completed.
Members
newvalueindex_ofinsertremove_atgetsetaddclearcontainscopy_tocountis_read_onlyremoveto_vec
new
fn new(source: Rc<dyn IObservable<T>>) -> Rc<Self>
The list of the values of source (ListObservable(IObservable<T>)).
value
fn value(self: &Self) -> Result<T, ObservableError>
where T: Clone
The last value (Value); an Err with SequenceError::NoElements when there is none.
index_of
fn index_of(self: &Self, item: &T) -> Result<Option<usize>, ObservableError>
where T: PartialEq
The index of the first value equal to item (IndexOf).
insert
fn insert(self: &Self, index: usize, item: T) -> Result<(), ObservableError>
Inserts item at index (Insert); an index beyond the count is an
ArgumentOutOfRangeError.
remove_at
fn remove_at(self: &Self, index: usize) -> Result<(), ObservableError>
Removes the value at index (RemoveAt).
get
fn get(self: &Self, index: usize) -> Result<T, ObservableError>
where T: Clone
The value at index (the getter of the indexer).
set
fn set(self: &Self, index: usize, value: T) -> Result<(), ObservableError>
Replaces the value at index (the setter of the indexer).
add
fn add(self: &Self, item: T) -> Result<(), ObservableError>
Adds item at the end (Add).
clear
fn clear(self: &Self) -> Result<(), ObservableError>
Removes every value (Clear).
contains
fn contains(self: &Self, item: &T) -> Result<bool, ObservableError>
where T: PartialEq
Whether a value equals item (Contains).
copy_to
fn copy_to(self: &Self, array: &mut [T], array_index: usize) -> Result<(), ObservableError>
where T: Clone
Copies the values into array from array_index on (CopyTo); an array too short is an
ArgumentOutOfRangeError.
count
fn count(self: &Self) -> Result<usize, ObservableError>
The count of the values (Count).
is_read_only
fn is_read_only(self: &Self) -> bool
Whether the list cannot be changed (IsReadOnly): it can.
remove
fn remove(self: &Self, item: &T) -> Result<bool, ObservableError>
where T: PartialEq
Removes the first value equal to item (Remove); whether there was one.
to_vec
fn to_vec(self: &Self) -> Result<Vec<T>, ObservableError>
where T: Clone
The values, in order (GetEnumerator).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnySubscribeGuard<T>IObservable<()>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.