Utility library to work with tuples.
Features:
-
Test if all elements are
Ok
:all_ok()
assert_eq!; assert_eq!;
-
Test if all elements are
Some
:all_some()
assert_eq!; assert_eq!;
-
Prepend an element to a tuple:
prepend()
assert_eq!;
-
Append an element to a tuple:
append()
assert_eq!;
-
Concatenate two tuples:
concat_tuples()
assert_eq!;
-
Concatenate multiple tuples:
concat_many()
assert_eq!;
-
Turn a reference to a tuple to a tuple of references:
ref_tuple()
assert_eq!;
-
Turn a reference to a mutable tuple to a tuple of mutable references:
tuple_ref_mut()
assert_eq!;
-
Extract the first element of a tuple:
unprepend()
assert_eq!;
-
Extract the last element of a tuple:
unappend()
assert_eq!;
-
Call a function with the tuple members as arguments:
apply()
let tpl3 = ; assert_eq!;
-
Element-wise wrap the element of a tuple in
Option
:option_tuple()
assert_eq!;
-
Get the length of a tuple:
length()
assert_eq!;
-
Map a tuple:
map_tuple()
; assert_eq!
Supported tuple lengths:
By default the selected operations are implemented to tuples upto a length of 16 elements
(features = ["default-len"]
).
You can specify a higher limit by using feature = ["X"]
, where X
can be
8, 16, 32, 64, 96, 128, 160, 192, 224, or 256. A higher number includes all lower numbers.