1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Some tools to manipulate tuples.
//!
//! Most traits in this crate are implemented for tuples with an arity inferior
//! or equal to eight.
//!
//! # `TupleAppend`
//!
//! There is no simple way to append a value of type `C` to a tuple of type
//! `(A, B)` in rust. This is permitted by [`TupleAppend`].
//!
//! ## Example
//!
//! Here, we append a [`char`] to a `(char, u32)`:
//!
//! ```rust
//! use lisbeth_tuple_tools::TupleAppend;
//!
//! let tup = ('l', 42).append('s');
//!
//! assert_eq!(tup, ('l', 42, 's'));
//! ```
//!
//! # `TupleMap*`
//!
//! This crate contains [`TupleMap1`], [`TupleMap2`], and so on. These traits
//! provide functions that allow to map a single element of a tuple from one
//! type to an other.
//!
//! ## Example
//!
//! The following example uses [`TupleMap1`], but it can be adapted to
//! any `TupleMap*` trait:
//!
//! ```rust
//! use lisbeth_tuple_tools::TupleMap1;
//!
//! let t = ('a', 0, "foo");
//! let t = t.map_1(char::len_utf8);
//!
//! assert_eq!(t, (1, 0, "foo"));
//! ```

mod append;
mod map;

pub use append::TupleAppend;
pub use map::*;