Skip to content

Commit e052d88

Browse files
committed
add state machine
1 parent 72fbb3d commit e052d88

16 files changed

Lines changed: 1488 additions & 0 deletions

File tree

‎rust_state_machine/CHANGELOG.md‎

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog][keepachangelog], and this project
6+
adheres to [Semantic Versioning][semver].
7+
8+
## [Unreleased]
9+
10+
## [0.8.0] - 2025-07-21
11+
12+
### Changed
13+
14+
- Updated `aquamarine` from `0.5` to `0.6`.
15+
16+
## [0.7.0] - 2024-06-01
17+
18+
### Changed
19+
20+
- All types generated by the `state_machine` macro are now confined in a module.
21+
The name of the module is passed to the macro as the name of the state
22+
machine. All generated types now have uniforms names: `Impl`, `Input`,
23+
`State`, `Output`.
24+
- If no outputs is specified in the `state_machine` macro, an empty `Output`
25+
enum is generated instead of using `()` for the sake of uniformity. No
26+
attributes (e.g. `derive` and `repr`) are applied on an empty `Output`,
27+
because many of them are simply not designed to work this way.
28+
- It is now possible to use proper Rust attributes like `#[derive(Debug)]`,
29+
`#[repr(C)]`, etc (any attribute you want really). This replaces the original
30+
way this macro had for using derives and specifying representation.
31+
- Use Rust 2021 edition.
32+
33+
### Added
34+
35+
- A type alias `StateMachine` for `rust_fsm::StateMachine<Impl>` is now
36+
generated inside the said module.
37+
- Supplying ones own enums for state, input and output in the proc-macro (#10).
38+
- An optional possibility to generate Mermaid diagrams.
39+
- Processing doc comments to generate the state machine module documentation.
40+
41+
## [0.6.2] - 2024-05-11
42+
43+
### Changed
44+
45+
- Update documentation.
46+
47+
### Added
48+
49+
- Derive `Debug` and `Clone` for `StateMachine` struct
50+
51+
## [0.6.1] - 2022-12-24
52+
53+
### Changed
54+
55+
- Use pattern matching in examples.
56+
57+
### Added
58+
59+
- Allow to specify `repr(C)` on generated enums.
60+
61+
## [0.6.0] - 2021-08-24
62+
63+
### Changed
64+
65+
- Updated to `1.x` versions of `syn` and `quote`.
66+
67+
## [0.5.0] - 2021-02-23
68+
69+
### Added
70+
71+
- The re-export of the DSL implementation is gated by the `dsl` feature which is
72+
enabled by default.
73+
74+
### Changed
75+
76+
- State transition error is now represented with `TransitionImpossibleError`
77+
instead of `()`.
78+
- The library is not `no_std` by default due to the use of `std::error::Error`.
79+
Users should disable the new `std` feature to use this library in a `no_std`
80+
environment.
81+
82+
## [0.4.0] - 2020-08-25
83+
84+
### Added
85+
86+
- Allow deriving different traits for generated traits.
87+
- Add the `from_state` method to start the machine from any given state.
88+
- `no_std` support (thanks @luctius).
89+
90+
### Removed
91+
92+
- All default derives on generated enums.
93+
- `Copy` constraint on `StateMachineImpl::State`.
94+
95+
## [0.3.0] - 2019-05-22
96+
97+
### Changed
98+
99+
- Re-organize repository to import a single crate instead of two.
100+
101+
## [0.2.0] - 2019-05-16
102+
103+
### Added
104+
105+
- Allow setting visibitility for generated state machine types by putting a
106+
visibility modifier before the state machine name.
107+
- Allow to specify multiple transitions from the same state in a more compact
108+
form. See the example for the details.
109+
110+
### Changed
111+
112+
- More clear naming:
113+
- Renamed the `StateMachineWrapper` structure to `StateMachine`;
114+
- Renamed the `StateMachine` trait to `StateMachineImpl`.
115+
116+
### Removed
117+
118+
- Removed the `consume_anyway` function.
119+
120+
## [0.1.0] - 2019-04-29
121+
122+
### Added
123+
124+
- The `StateMachine` trait for formal definitions of state machines and
125+
transducers.
126+
- The `StateMachineWrapper` struct - a convenience wrapper around `StateMachine`
127+
for practical usage.
128+
- The first implementation of the DSL for defining state machines that allows
129+
to:
130+
- Define a state machine with its initial state;
131+
- Define state transitions;
132+
- Define outputs;
133+
- Generate boilerplates implementing `StateMachine`.
134+
135+
[keepachangelog]: https://keepachangelog.com/en/1.0.0/
136+
[semver]: https://semver.org/spec/v2.0.0.html
137+
[Unreleased]:
138+
https://github.com/eugene-babichenko/rust-fsm/compare/v0.8.0...HEAD
139+
[0.8.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.8.0...v0.7.0
140+
[0.7.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.7.0...v0.6.2
141+
[0.6.2]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.6.2...v0.6.1
142+
[0.6.1]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.6.0...v0.6.1
143+
[0.6.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.5.0...v0.6.0
144+
[0.5.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.4.0...v0.5.0
145+
[0.4.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.3.0...v0.4.0
146+
[0.3.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.2.0...0.3.0
147+
[0.2.0]: https://github.com/eugene-babichenko/rust-fsm/compare/v0.1.0...0.2.0
148+
[0.1.0]: https://github.com/eugene-babichenko/rust-fsm/releases/tag/v0.1.0

‎rust_state_machine/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[workspace]
2+
resolver = "2"
3+
members = ["rust-fsm", "rust-fsm-dsl", "doc-example"]

‎rust_state_machine/LICENCE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Yevhenii Babichenko
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)