6 个版本 (稳定)
3.0.0 | 2024年4月27日 |
---|---|
2.0.0 | 2023年1月13日 |
1.1.0 | 2022年10月31日 |
1.0.0 | 2020年9月24日 |
0.1.1 | 2020年9月22日 |
88 在 无标准库 中排名
61 每月下载量
在 3 个 Crates 中使用(通过 elephantry)
5KB
93 行
tuple_len
获取元组中元素的数量。
用法
将其添加到您的依赖中
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);