Struct remoc_obs::list::ObservableList
source · [−]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
sourceimpl<T, Codec> ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
impl<T, Codec> ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
sourcepub fn set_error_handler<E>(&mut self, on_err: E) where
E: Fn(SendError) + Send + Sync + 'static,
pub fn set_error_handler<E>(&mut self, on_err: E) where
E: Fn(SendError) + Send + Sync + 'static,
Sets the error handler function that is called when sending an event fails.
sourcepub fn distributor(&self) -> ObservableListDistributor<T, Codec>
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>
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
pub fn subscriber_count(&self) -> usize
Current number of subscribers.
sourcepub fn closed(&self) -> impl Future<Output = ()>
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 push(&mut self, value: T)
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 done(&mut self)
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
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>
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
sourceimpl<T, Codec> Debug for ObservableList<T, Codec>
impl<T, Codec> Debug for ObservableList<T, Codec>
sourceimpl<T, Codec> Default for ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
impl<T, Codec> Default for ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
sourceimpl<T, Codec> Drop for ObservableList<T, Codec>
impl<T, Codec> Drop for ObservableList<T, Codec>
sourceimpl<T, Codec> Extend<T> for ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
impl<T, Codec> Extend<T> for ObservableList<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
sourcefn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations
impl<T, Codec = Default> !RefUnwindSafe for ObservableList<T, Codec>
impl<T, Codec> Send for ObservableList<T, Codec> where
Codec: Send,
T: Send,
impl<T, Codec> Sync for ObservableList<T, Codec> where
Codec: Send,
T: Send,
impl<T, Codec> Unpin for ObservableList<T, Codec>
impl<T, Codec = Default> !UnwindSafe for ObservableList<T, Codec>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more