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