#no-std #no-std

no-std tuple_len

Get the number of elements in a tuple

5 releases (3 stable)

2.0.0 Jan 13, 2023
1.1.0 Oct 31, 2022
1.0.0 Sep 24, 2020
0.1.1 Sep 22, 2020
0.1.0 Sep 22, 2020

#89 in No standard library

Download history 55/week @ 2022-10-08 9/week @ 2022-10-15 7/week @ 2022-10-22 88/week @ 2022-10-29 24/week @ 2022-11-05 11/week @ 2022-11-12 30/week @ 2022-11-19 11/week @ 2022-11-26 11/week @ 2022-12-03 13/week @ 2022-12-10 9/week @ 2022-12-17 16/week @ 2022-12-24 6/week @ 2022-12-31 23/week @ 2023-01-07 25/week @ 2023-01-14 18/week @ 2023-01-21

74 downloads per month
Used in 2 crates (via elephantry)

MIT license

5KB
86 lines

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

No runtime deps