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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! [tuplities](https://github.com/lucacappelletti94/tuplities) suite crate providing the `TupleRef` trait.
/// A trait for tuples that provides a method to get a tuple of references.
///
/// This trait provides both an associated type `Ref<'a>` that represents a tuple
/// of references to the elements, and a method `tuple_ref` that returns such a tuple.
///
/// # Examples
///
/// ```rust
/// use tuplities_ref::TupleRef;
///
/// let tuple = (1, "hello".to_string(), vec![1, 2, 3]);
/// let refs = tuple.tuple_ref();
/// assert_eq!(refs, (&1, &"hello".to_string(), &vec![1, 2, 3]));
/// ```
///
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.
/// A trait for applying `TupleRef` to each element of a tuple.
///
/// This trait takes a tuple where each element implements `TupleRef` and returns
/// a tuple where each element is the result of calling `tuple_ref()` on the original elements.
///
/// # Examples
///
/// ```rust
/// use tuplities_ref::TupleRefMap;
///
/// let matrix = ((1, 2), (3, 4), (5, 6));
/// let ref_matrix = matrix.tuple_ref_map();
/// assert_eq!(ref_matrix, ((&1, &2), (&3, &4), (&5, &6)));
/// ```
///
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.