Struct sodium::StreamSink
source · pub struct StreamSink<A> {
pub impl_: StreamSink<A>,
}
Expand description
Fields§
§impl_: StreamSink<A>
Implementations§
source§impl<A: Clone + Send + 'static> StreamSink<A>
impl<A: Clone + Send + 'static> StreamSink<A>
sourcepub fn new(sodium_ctx: &SodiumCtx) -> StreamSink<A>
pub fn new(sodium_ctx: &SodiumCtx) -> StreamSink<A>
Create a StreamSink
that allows calling send
on it once
per transaction.
If you call send
more than once in a transaction on a
StreamSink
constructed with StreamSink::new
it will
panic. If you need to do this then use
StreamSink::new_with_coalescer
.
sourcepub fn new_with_coalescer<COALESCER: FnMut(&A, &A) -> A + Send + 'static>(
sodium_ctx: &SodiumCtx,
coalescer: COALESCER
) -> StreamSink<A>
pub fn new_with_coalescer<COALESCER: FnMut(&A, &A) -> A + Send + 'static>( sodium_ctx: &SodiumCtx, coalescer: COALESCER ) -> StreamSink<A>
Create a StreamSink
that allows calling send
one or more
times per transaction.
If you call send
on the returned StreamSink
more than once
in a single transaction the events will be combined into a
single event using the specified combining function. The
combining function should be associative.
sourcepub fn stream(&self) -> Stream<A>
pub fn stream(&self) -> Stream<A>
Return a Stream
that can be used in the creation of Sodium
logic that will consume events pushed into this StreamSink
from the I/O world.
sourcepub fn send(&self, a: A)
pub fn send(&self, a: A)
Send a value to be made available to consumers of the Stream
associated with this StreamSink
.
This method may not be called in handlers registered with
Stream::listen
or Cell::listen
.