Struct veilid_tools::DeferredStreamProcessor
source · pub struct DeferredStreamProcessor {
pub opt_deferred_stream_channel: Option<Sender<SendPinBoxFuture<()>>>,
pub opt_stopper: Option<StopSource>,
pub opt_join_handle: Option<MustJoinHandle<()>>,
}Expand description
Background processor for streams Handles streams to completion, passing each item from the stream to a callback
Fields§
§opt_deferred_stream_channel: Option<Sender<SendPinBoxFuture<()>>>§opt_stopper: Option<StopSource>§opt_join_handle: Option<MustJoinHandle<()>>Implementations§
source§impl DeferredStreamProcessor
impl DeferredStreamProcessor
sourcepub fn add<T: Send + 'static>(
&mut self,
receiver: Receiver<T>,
handler: impl FnMut(T) -> SendPinBoxFuture<bool> + Send + 'static,
) -> bool
pub fn add<T: Send + 'static>( &mut self, receiver: Receiver<T>, handler: impl FnMut(T) -> SendPinBoxFuture<bool> + Send + 'static, ) -> bool
Queue a stream to process in the background
- ‘receiver’ is the stream to process
- ‘handler’ is the callback to handle each item from the stream Returns ‘true’ if the stream was added for processing, and ‘false’ if the stream could not be added, possibly due to not being initialized
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeferredStreamProcessor
impl RefUnwindSafe for DeferredStreamProcessor
impl Send for DeferredStreamProcessor
impl Sync for DeferredStreamProcessor
impl Unpin for DeferredStreamProcessor
impl UnwindSafe for DeferredStreamProcessor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more