tuple
Element wise operations on tuples!
Documentation
This crate allows to generalize operations to tuples using macros. Please look at the Documentation for examples.
Features
impl_num
(default) add support for (some) num traitsimpl_serde
(default) add support for serialization and deserialization (depends on serde)impl_simd
add support for (some) simd-types (depends on stdsimd and is only available on nightly)
Supported Operations
TupleElements
trait (for tuples where all elements have the same type)get
andget_mut
functionsN
(number of elements)
ops
Index
,IndexMut
Clone
,Copy
Add
,AddAssign
Sub
,SubAssign
Mul
,Div
Neg
fmt::Debug
iter
Iterator
Iterate over all elements at once (assuming they implementIterator
). The iterations stops once one or more elements returnNone
.
convert
From
andInto
their tuple equivalent.From
andInto
their array equivalent.TryFrom
slice
Map<T>
traitmap
: apply a function to each element and return the resulting tuple
- other
rev
: reverse the elementsrot_l
androt_r
: rotate elementssplit
: make two separate tuples out of onejoin
: turn two tuples into one