pub trait TupleFnOnce<Args> {
type TupleFnOutput;
// Required method
fn call_once_with_args_tuple(self, args: Args) -> Self::TupleFnOutput;
}
Expand description
Enables the types which implements FnOnce
to be called with arguments tuple.
use tuple_fn::TupleFnOnce;
let start = "hello".to_string();
let closure = move |s1, s2| {
let mut start = start;
start.push_str(" ");
start.push_str(s1);
start.push_str(" ");
start.push_str(s2);
start
};
let result = closure.call_once_with_args_tuple(("world", "!"));
assert_eq!(result, "hello world !");