| Crates.io | tuple_len |
| lib.rs | tuple_len |
| version | 3.0.0 |
| created_at | 2020-09-22 09:26:04.281296+00 |
| updated_at | 2024-04-27 09:05:34.781247+00 |
| description | Get the number of elements in a tuple |
| homepage | |
| repository | https://github.com/sanpii/tuple_len |
| max_upload_size | |
| id | 291469 |
| size | 7,756 |
Get the number of elements in a tuple.
Add it to your dependencies:
cargo add tuple_len
// The macro way, compute at compilation time
assert_eq!(tuple_len::tuple_len!(("hello", 5, 'c')), 3);
// The trait way — limited to sized 12 tuple
use tuple_len::TupleLen;
assert_eq!(().len(), 0);
// The function way — idem
let tuple = (1,);
assert_eq!(tuple_len::len(&tuple), 1);