Struct remoc_obs::mpsc_replay::ReplayBuffer
source · [−]pub struct ReplayBuffer<T, Codec = Default> { /* private fields */ }Expand description
A buffer that stores and replays values sent to it.
Values sent to the replay channel buffer are stored in an internal buffer. Multiple remote MPSC channels can be subscribed to the replay channel buffer and each channel will receive all values sent to the replay channel buffer, even the values that were received before it was subscribed.
When dropped all channels to the subscribers are closed immediately. Use keep if you want to avoid this.
Implementations
sourceimpl<T, Codec> ReplayBuffer<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
impl<T, Codec> ReplayBuffer<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
sourcepub fn new(rx: Receiver<T>) -> Self
pub fn new(rx: Receiver<T>) -> Self
Creates a new replay channel buffer.
The replay channel buffer is fed from the receiver rx.
sourcepub fn new_unbounded(rx: UnboundedReceiver<T>) -> Self
pub fn new_unbounded(rx: UnboundedReceiver<T>) -> Self
Creates a new replay channel buffer.
The replay channel buffer is fed from the unbounded receiver rx.
sourcepub fn keep(&mut self)
pub fn keep(&mut self)
When this replay buffer is dropped, ensures that all outstanding values are sent to the subscribers.
sourcepub fn subscribe<C, B>(&self, tx: Sender<T, C, B>) -> SubscriptionHandleⓘNotable traits for SubscriptionHandleimpl Future for SubscriptionHandle type Output = Result<(), SendError<()>>; where
C: Codec,
B: Size,
pub fn subscribe<C, B>(&self, tx: Sender<T, C, B>) -> SubscriptionHandleⓘNotable traits for SubscriptionHandleimpl Future for SubscriptionHandle type Output = Result<(), SendError<()>>; where
C: Codec,
B: Size,
Subscribes a remote MPSC channel to the replay channel buffer.
The channel will receive all values ever sent and future values that will be sent to the replay channel buffer.
The returned SubscriptionHandle can be used to query for errors that occur during sending to the channel.
Trait Implementations
sourceimpl<T, Codec> Debug for ReplayBuffer<T, Codec>
impl<T, Codec> Debug for ReplayBuffer<T, Codec>
sourceimpl<T, Codec> Default for ReplayBuffer<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
impl<T, Codec> Default for ReplayBuffer<T, Codec> where
T: RemoteSend + Clone,
Codec: Codec,
Auto Trait Implementations
impl<T, Codec = Default> !RefUnwindSafe for ReplayBuffer<T, Codec>
impl<T, Codec> Send for ReplayBuffer<T, Codec> where
Codec: Send,
T: Send,
impl<T, Codec> Sync for ReplayBuffer<T, Codec> where
Codec: Send,
T: Send,
impl<T, Codec> Unpin for ReplayBuffer<T, Codec>
impl<T, Codec = Default> !UnwindSafe for ReplayBuffer<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