Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
Commandtrait and its implementations to improve type safety and consistency. The changes include modifying the trait to use an associated type for events, updating method signatures, and adjusting implementations accordingly.Key changes include:
Trait Refactoring:
Commandtrait now uses an associated typeEventinstead of a generic parameter, which simplifies the trait's usage and improves type safety. (src/command.rs,[[1]](https://github.com/jwilger/mneme/pull/36/files#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL6-R17),[[2]](https://github.com/jwilger/mneme/pull/36/files#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL29-R43))AggregateStatetrait'sapplymethod now takes a reference to the event instead of consuming it, which aligns with the newCommandtrait. (src/command.rs,[src/command.rsL29-R43](https://github.com/jwilger/mneme/pull/36/files#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL29-R43))Method Signature Updates:
handleandapplymethods in theCommandtrait to use the associatedEventtype. (src/command.rs,[src/command.rsL6-R17](https://github.com/jwilger/mneme/pull/36/files#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL6-R17))set_statemethod to take a mutable reference toselfinstead of consumingself. (src/command.rs,[src/command.rsL6-R17](https://github.com/jwilger/mneme/pull/36/files#diff-de6b9cfd1a256da7900d35e26aa7279bd713110e68e91b52616befb7397848dfL6-R17))Implementation Adjustments:
Commandtrait in the test cases to match the new trait definition. (src/lib.rs,[[1]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L171-R177),[[2]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L329-R338),[[3]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L466-R465),tests/test_cases.rs,[[4]](https://github.com/jwilger/mneme/pull/36/files#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L24-R25),[[5]](https://github.com/jwilger/mneme/pull/36/files#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L55-R55),[[6]](https://github.com/jwilger/mneme/pull/36/files#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L82-R81),[[7]](https://github.com/jwilger/mneme/pull/36/files#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L141-R148))applymethod inAggregateStateimplementations to match the new signature. (src/lib.rs,[[1]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L383-R388),tests/test_cases.rs,[[2]](https://github.com/jwilger/mneme/pull/36/files#diff-4300fcbb75cb722103f54594a5422baf31a5e7753a5ad32e7f9eb2ecdf9b8c83L108-R112))Function Signature Updates:
executefunction to use the newCommandtrait definition with the associatedEventtype. (src/lib.rs,[[1]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L23-R23),[[2]](https://github.com/jwilger/mneme/pull/36/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L48-R48))