pub struct ObservableList<T, Codec = Default> { /* private fields */ }Expand description
An append-only list that emits an event for each change.
Use subscribe to obtain an event stream that can be used for building a mirror of this list.
The distributor method can be used to obtain a clonable object that can be used to make subscriptions from other tasks.
Implementationsยง
Sourceยงimpl<T, Codec> ObservableList<T, Codec>
impl<T, Codec> ObservableList<T, Codec>
Sourcepub fn new() -> Self
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn new() -> Self
Creates a new, empty observable list.
Sourcepub fn set_error_handler<E>(&mut self, on_err: E)
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn set_error_handler<E>(&mut self, on_err: E)
Sets the error handler function that is called when sending an event fails.
Sourcepub fn distributor(&self) -> ObservableListDistributor<T, Codec>
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn distributor(&self) -> ObservableListDistributor<T, Codec>
Returns an observable list distributor that can be used to make subscriptions to this observable list.
It is clonable and can be sent to other tasks.
Sourcepub fn subscribe(&self) -> ListSubscription<T, Codec>
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn subscribe(&self) -> ListSubscription<T, Codec>
Subscribes to the observable list with incremental sending of the current contents.
Sourcepub fn subscriber_count(&self) -> usize
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn subscriber_count(&self) -> usize
Current number of subscribers.
Sourcepub fn notifier(&self) -> ChangeNotifier
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn notifier(&self) -> ChangeNotifier
Returns a change notifier that can be used locally to be notified of changes to this collection.
Sourcepub fn closed(&self) -> impl Future<Output = ()>
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn closed(&self) -> impl Future<Output = ()>
Returns when all subscribers have quit.
If no subscribers are currently present, this return immediately. This also returns when done has been called and all subscribers have received all elements of the list.
Sourcepub fn is_closed(&self) -> bool
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn is_closed(&self) -> bool
Returns true if there are currently no subscribers.
Sourcepub fn push(&mut self, value: T)
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn push(&mut self, value: T)
Appends an element at the end.
A ListEvent::Push change event is sent.
ยงPanics
Panics when done has been called before.
Sourcepub fn len(&self) -> usize
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn len(&self) -> usize
The current number of elements in the observable list.
Sourcepub fn is_empty(&self) -> bool
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn is_empty(&self) -> bool
Returns whether this observable list is empty.
Sourcepub fn done(&mut self)
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn done(&mut self)
Prevents further changes of this list and notifies are subscribers that no further events will occur.
Methods that modify the list will panic after this has been called. It is still possible to subscribe to this observable list.
Sourcepub fn is_done(&self) -> bool
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub fn is_done(&self) -> bool
Returns true if done has been called and further
changes are prohibited.
Methods that modify the list will panic in this case.
Sourcepub async fn borrow<'a>(&'a self) -> ObservableListRef<'a, T>
๐Deprecated: remoc-obs has been integrated into remoc as module remoc::robs. Please update your references.
pub async fn borrow<'a>(&'a self) -> ObservableListRef<'a, T>
Borrows the current value of the observable list.
While the borrow is held sending of events to subscribers is paused.
Trait Implementationsยง
Sourceยงimpl<T, Codec> Debug for ObservableList<T, Codec>
impl<T, Codec> Debug for ObservableList<T, Codec>
Sourceยงimpl<T, Codec> Default for ObservableList<T, Codec>
impl<T, Codec> Default for ObservableList<T, Codec>
Sourceยงimpl<T, Codec> Drop for ObservableList<T, Codec>
impl<T, Codec> Drop for ObservableList<T, Codec>
Sourceยงimpl<T, Codec> Extend<T> for ObservableList<T, Codec>
impl<T, Codec> Extend<T> for ObservableList<T, Codec>
Sourceยงfn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Sourceยงfn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Sourceยงfn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)