#tuple #traits #no-std #tuple-len

no-std tuple_length

Library for determining the length of a tuple

3 unstable releases

0.2.0 Feb 13, 2023
0.1.2 Jan 11, 2023
0.1.1 Jan 11, 2023

#2963 in Rust patterns

GPL-3.0-or-later

7KB
88 lines

Library for determining the length of a tuple.

Return the length of a tuple.

Examples

Usage:

use tuple_length::TupLen;

assert_eq!(().len(), 0);
assert_eq!((1i8,).len(), 1);
assert_eq!((1u16, 2u64).len(), 2);
assert_eq!((1i8, 2usize, 3i64).len(), 3);

Supported tuple lengths

Possible length 8, 16, 32, 64. By default the selected operations are implemented to tuples upto a length of 8 elements.

Features

You can specify the length: features = ["16"] or features = ["32"] or features = ["64"].


lib.rs:

Return the length of a tuple.

Examples

Usage:

assert_eq!(().len(), 0);
assert_eq!((1i8,).len(), 1);
assert_eq!((1u16, 2u64).len(), 2);
assert_eq!((1i8, 2usize, 3i64).len(), 3);

Supported tuple lengths

Possible length 8, 16, 32, 64. By default the selected operations are implemented to tuples upto a length of 8 elements.

Features

You can specify the length: features = ["tup_len_16"] or features = ["tup_len_32"] or features = ["tup_len_64"].

Dependencies