tuple
Element wise operations on tuples!
Documentation
This crate allows to generalize operations to tuples using macros.
Examples
extern crate tuple;
use *;
Element-wise operations
let a = T2 + T2;
assert_eq!;
let b = T2 * T2;
assert_eq!;
Indexing
This is implemented in the TupleElements
trait.
Indexing works as expected and panics when out of bounds.
There are also get
and get_mut
functions that return Option<&T>
and Option<&mut T>
.
assert_eq!;
assert_eq!;
assert_eq!;
Adding a Trait
extern crate tuple;
extern crate num_traits;
use *;
use Zero;
use ;
use Debug;
// The name is up to you
// actually implement it!
impl_tuple!;