Skip to content

Use references to mutable state in commands#37

Merged
jwilger merged 1 commit intomainfrom
mutable-state
Mar 14, 2025
Merged

Use references to mutable state in commands#37
jwilger merged 1 commit intomainfrom
mutable-state

Conversation

@jwilger
Copy link
Copy Markdown
Owner

@jwilger jwilger commented Mar 14, 2025

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: Updated the version of the mneme package from 0.4.2 to 0.5.0.

Method signature updates:

  • src/command.rs: Changed the set_state method in the Command trait to take a reference to Self::State.
  • src/lib.rs: Updated the set_state methods in test implementations to take a reference to Self::State. [1] [2] [3]
  • tests/test_cases.rs: Modified the set_state methods in various command implementations to take a reference to Self::State. [1] [2] [3] [4]

State handling improvements:

  • src/command.rs: 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: Changed the apply method in the StatefulCommandState implementation to return a reference to self.
  • tests/test_cases.rs: Updated the apply method in the StatefulCommandState implementation to return a reference to self.

@jwilger jwilger merged commit a5fd077 into main Mar 14, 2025
2 checks passed
@jwilger jwilger deleted the mutable-state branch March 14, 2025 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant