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
69
70
71
72
//! [tuplities](https://github.com/lucacappelletti94/tuplities) suite crate providing the `TupleMut` trait.
/// A trait for tuples that provides a method to get a tuple of mutable references.
///
/// This trait provides both an associated type `Mut<'a>` that represents a tuple
/// of mutable references to the elements, and a method `tuple_mut` that returns such a tuple.
///
/// # Examples
///
/// ```rust
/// use tuplities_mut::TupleMut;
///
/// let mut tuple = (1, "hello".to_string(), vec![1, 2, 3]);
/// let mut_refs = tuple.tuple_mut();
/// *mut_refs.0 = 42;
/// mut_refs.1.push_str(" world");
/// mut_refs.2.push(4);
/// assert_eq!(tuple, (42, "hello world".to_string(), vec![1, 2, 3, 4]));
/// ```
///
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.
/// A trait for applying `TupleMut` to each element of a tuple.
///
/// This trait takes a mutable reference to a tuple where each element implements `TupleMut` and returns
/// a tuple where each element is the result of calling `tuple_mut()` on the original elements.
///
/// # Examples
///
/// ```rust
/// use tuplities_mut::TupleMutMap;
///
/// let mut matrix = ((1, 2), (3, 4), (5, 6));
/// let mut_ref_matrix = matrix.tuple_mut_map();
/// assert_eq!(mut_ref_matrix, ((&mut 1, &mut 2), (&mut 3, &mut 4), (&mut 5, &mut 6)));
/// ```
///
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.