Function combine::produce [−][src]
pub fn produce<Input, F, R>(f: F) -> Produce<Input, F> where
Input: Stream,
F: FnMut() -> R,
Expand description
Always returns the value produced by calling f
.
Can be used when value
is unable to be used for lack of Clone
implementation on the value.
#[derive(Debug, PartialEq)] struct NoClone; let result = produce(|| vec![NoClone]) .parse("hello world") .map(|x| x.0); assert_eq!(result, Ok(vec![NoClone]));