tuple-fn 1.2.0

call functions and closures with tuple of arguments
Documentation
  • Coverage
  • 66.67%
    12 out of 18 items documented12 out of 17 items with examples
  • Size
  • Source code size: 19.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.51 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • EqualMa/tuple-fn
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • EqualMa

tuple-fn

Crates.io docs.rs GitHub license GitHub stars

This crate provides [TupleFnOnce], [TupleFnMut] and [TupleFn], corresponding to [FnOnce], [FnMut] and [Fn].

[TupleFnOnce], [TupleFnMut] and [TupleFn] enables functions or closures to be called with a tuple of arguments. For example:

use tuple_fn::*;

fn add(a: i32, b: i32) -> i32 {
    a + b
}

let sum = add.call_with_args_tuple((1, 2));
assert_eq!(sum, 3);

These three traits should be named as FnOnceCallWithArgsTupleExt, FnMutCallWithArgsTupleExt, FnCallWithArgsTupleExt by convention, because they are implemented for all corresponding FnOnce, FnMut, Fn types and act like extension traits. They are named as TupleFn* just for simplicity.