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]));