[−][src]Struct froop::Sink
A sink is a producer of events. Created by Stream::sink()
.
Methods
impl<T> Sink<T>
[src]
pub fn stream(&self) -> Stream<T>
[src]
Get a stream of events from this sink. One stream instance is created for each call, and they all receive the events from the sink.
let sink = froop::Stream::sink(); let stream1 = sink.stream(); let stream2 = sink.stream(); let coll1 = stream1.collect(); let coll2 = stream1.collect(); sink.update(42); sink.end(); assert_eq!(coll1.wait(), vec![42]); assert_eq!(coll2.wait(), vec![42]);
pub fn update(&self, next: T)
[src]
Update a value into this sink.
The execution of the combinators "hanging" off this sink is (thread safe) and
synchronous. In other words, there is nothing in froop itself that will still be
"to do" once the update()
call returns.
Each value is wrapped in an Option
towards subscribers of the streams.
let sink = froop::Stream::sink(); let stream = sink.stream(); stream.subscribe(|v| { // v is Some(0), Some(1), None }); sink.update(0); sink.update(1); sink.end();
pub fn end(self)
[src]
End the stream of events. Consumes the instance since no more values are to go into it.
Subscribers will se a None
value.
Every stream hanging directly off this sink will also end. The exception is streams combining input from multiple source streams.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,