Skip to content

Commit 30433be

Browse files
authored
Merge pull request #17 from hashmismatch/docs
Docs update
2 parents 0ac9a54 + cd9bd23 commit 30433be

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

README.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1-
# Finny - Finite State Machines for Rust
1+
## Finny - Hierarchical Finite State Machines for Rust
22

3+
[![Crates.io][crates-badge]][crates-url]
4+
[![Documentation](https://docs.rs/finny/badge.svg)](https://docs.rs/finny)
35
![Build](https://github.com/hashmismatch/finny.rs/workflows/Build/badge.svg)
46

5-
## Features
7+
### Features
68
* Declarative, builder API with a procedural function macro that generate the dispatcher
79
* Compile-time transition graph validation
810
* No run-time allocations required, `no_std` support
911
* Support for generics within the shared context
1012
* Transition guards and actions
11-
* FSM regions, also known as orthogonal states
13+
* State regions, also known as orthogonal states
1214
* Event queueing and run-to-completition execution
15+
* Submachines, also known as Hierarchical State Machines
16+
* Timers on states
1317

14-
## Example
18+
### Example
19+
20+
#### Cargo.toml
21+
22+
```toml
23+
[dependencies]
24+
finny = "0.2"
25+
```
26+
27+
#### Code
1528

1629
```rust
17-
extern crate finny;
1830
use finny::{finny_fsm, FsmFactory, FsmResult, decl::{BuiltFsm, FsmBuilder}};
1931

2032
// The context is shared between all guards, actions and transitions. Generics are supported here!
@@ -40,7 +52,7 @@ fn my_fsm(mut fsm: FsmBuilder<MyFsm, MyContext>) -> BuiltFsm {
4052
})
4153
.on_event::<MyEvent>()
4254
.transition_to::<MyStateB>()
43-
.guard(|_ev, ctx| { ctx.context.val > 0 })
55+
.guard(|_ev, ctx, _states| { ctx.context.val > 0 })
4456
.action(|_ev, ctx, state_a, state_b| { ctx.context.val += 1; });
4557
fsm.state::<MyStateB>();
4658
fsm.initial_state::<MyStateA>();
@@ -60,5 +72,7 @@ fn main() -> FsmResult<()> {
6072
Ok(())
6173
}
6274
```
75+
[crates-badge]: https://img.shields.io/crates/v/finny.svg
76+
[crates-url]: https://crates.io/crates/finny
6377

64-
License: MIT OR Apache-2.0
78+
License: MIT OR Apache-2.0

finny/src/lib.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#![cfg_attr(not(feature = "std"), no_std)]
22

3-
//! # Finny - Finite State Machines for Rust
3+
//! # Finny - Hierarchical Finite State Machines for Rust
44
//!
5+
//! [![Crates.io][crates-badge]][crates-url]
6+
//! [![Documentation](https://docs.rs/finny/badge.svg)](https://docs.rs/finny)
57
//! ![Build](https://github.com/hashmismatch/finny.rs/workflows/Build/badge.svg)
68
//!
79
//! ## Features
@@ -10,14 +12,23 @@
1012
//! * No run-time allocations required, `no_std` support
1113
//! * Support for generics within the shared context
1214
//! * Transition guards and actions
13-
//! * FSM regions, also known as orthogonal states
15+
//! * State regions, also known as orthogonal states
1416
//! * Event queueing and run-to-completition execution
15-
//! * Submachines, also known as Hieararchical State Machines
17+
//! * Submachines, also known as Hierarchical State Machines
18+
//! * Timers on states
1619
//!
1720
//! ## Example
1821
//!
22+
//! ### Cargo.toml
23+
//!
24+
//! ```toml
25+
//! [dependencies]
26+
//! finny = "0.2"
27+
//! ```
28+
//!
29+
//! ### Code
30+
//!
1931
//! ```rust
20-
//! extern crate finny;
2132
//! use finny::{finny_fsm, FsmFactory, FsmResult, decl::{BuiltFsm, FsmBuilder}};
2233
//!
2334
//! // The context is shared between all guards, actions and transitions. Generics are supported here!
@@ -63,6 +74,8 @@
6374
//! Ok(())
6475
//! }
6576
//! ```
77+
//! [crates-badge]: https://img.shields.io/crates/v/finny.svg
78+
//! [crates-url]: https://crates.io/crates/finny
6679
6780
pub mod decl;
6881
mod fsm;

0 commit comments

Comments
 (0)