/// Creates a new stream which calls a closure on each context/value and uses
/// that as the context.
///
/// # Examples
///
/// ```
/// # use reactive_rs::*;
/// let stream = SimpleBroadcast::<String>::new();
/// let string_and_len = stream.with_ctx_map(|_, s| s.len());
/// ```
///
/// # Notes
///
/// - The value is passed down unchanged.
/// - The closure receives all of its arguments by reference.
/// - The return value is a `Stream` object (context type is the return
///   type of the closure; value type is unchanged).
Creates a new stream which calls a closure on each context/value and uses
that as the context.
Creates a new stream which calls a closure on each context / value and uses that as the context .
fn with_ctx_map<F, T>(self, func: F) -> WithContextMap<Self, F>
    where
        F: 'a + FnMut(&Self::Context, &Self::Item) -> T,
    {
        WithContextMap { stream: self, func }
    }
fn with_ctx_map < F , T > ( self , func : F ) -> WithContextMap < Self , F > where F : ' a + FnMut ( & Self :: Context , & Self :: Item ) -> T , { WithContextMap { stream : self , func } }
Creates a new stream which calls a closure on each context/value and uses
that as the context.
Creates a new stream which calls a closure on each context / value and uses that as the context .
self
func
F
examples
None
use reactive_rs::*;
let stream = SimpleBroadcast::::new();
let string_and_len = stream.with_ctx_map(|_, s| s.len());
```
let stream = SimpleBroadcast :::: new () ; let string_and_len = stream . with_ctx_map ( |_ s| s . len () ) ; ` ` `
notes
The value is passed down unchanged.
The closure receives all of its arguments by reference.
The return value is a `Stream` object (context type is the return
type of the closure; value type is unchanged).
The value is passed down unchanged . The closure receives all of its arguments by reference . The return value is a ` Stream ` object ( context type is the return type of the closure ; value type is unchanged ) .