Commit a5fd077
authored
Use references to mutable state in commands (#37)
This pull request includes several changes to the `mneme` Rust project,
focusing on updating method signatures and improving state handling. The
most important changes include modifying the `set_state` method to take
a reference and updating the `apply` method to return a reference to
`self`.
Version update:
*
[`Cargo.toml`](diffhunk://#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542L3-R3):
Updated the version of the `mneme` package from `0.4.2` to `0.5.0`.
Method signature updates:
*
[`src/command.rs`](diffhunk://#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL17-R17):
Changed the `set_state` method in the `Command` trait to take a
reference to `Self::State`.
*
[`src/lib.rs`](diffhunk://#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L177-R177):
Updated the `set_state` methods in test implementations to take a
reference to `Self::State`.
[[1]](diffhunk://#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L177-R177)
[[2]](diffhunk://#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L337-R338)
[[3]](diffhunk://#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L479-R478)
*
[`tests/test_cases.rs`](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L36-R36):
Modified the `set_state` methods in various command implementations to
take a reference to `Self::State`.
[[1]](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L36-R36)
[[2]](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L66-R66)
[[3]](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L95-R95)
[[4]](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L147-R147)
State handling improvements:
*
[`src/command.rs`](diffhunk://#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL39-R45):
Updated the `apply` method in the `AggregateState` trait to return a
reference to `self` and modified the implementation for the unit type.
*
[`src/lib.rs`](diffhunk://#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L381-R391):
Changed the `apply` method in the `StatefulCommandState` implementation
to return a reference to `self`.
*
[`tests/test_cases.rs`](diffhunk://#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L105-R115):
Updated the `apply` method in the `StatefulCommandState` implementation
to return a reference to `self`.1 parent e5bf792 commit a5fd077
File tree
5 files changed
+34
-34
lines changed- src
- tests
5 files changed
+34
-34
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
| 337 | + | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
382 | 382 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
392 | 390 | | |
| 391 | + | |
393 | 392 | | |
394 | 393 | | |
395 | 394 | | |
| |||
476 | 475 | | |
477 | 476 | | |
478 | 477 | | |
479 | | - | |
| 478 | + | |
480 | 479 | | |
481 | 480 | | |
482 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
116 | 114 | | |
| 115 | + | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
| |||
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
147 | | - | |
148 | | - | |
| 146 | + | |
| 147 | + | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
| |||
0 commit comments