tuple_len

Crates.iotuple_len
lib.rstuple_len
version3.0.0
sourcesrc
created_at2020-09-22 09:26:04.281296
updated_at2024-04-27 09:05:34.781247
descriptionGet the number of elements in a tuple
homepage
repositoryhttps://github.com/sanpii/tuple_len
max_upload_size
id291469
size7,756
Sanpi (sanpii)

documentation

README

tuple_len

Github actions Gitlab CI

Get the number of elements in a tuple.

Usage

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);
Commit count: 40

cargo fmt