tuple_len 2.0.0

Get the number of elements in a tuple
Documentation

tuple_len

Github actions Gitlab CI

Get the number of elements in a tuple.

Usage

Add it to your dependencies:

[dependencies]
tuple_len = "2.0"
// The macro way, compute at compilation time
assert_eq!(tuple_len::tuple_len!(("hello", 5, 'c')), 3);

// The trait way
use tuple_len::TupleLen;
assert_eq!(().len(), 0);

// The function way
let tuple = (1,);
assert_eq!(tuple_len::len(&tuple), 1);