Finite state machines in rust; bendns fork to add types.
feature-gate DSL re-export
| -rw-r--r-- | .github/workflows/tests.yml | 2 | ||||
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | Cargo.toml | 5 | ||||
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | src/lib.rs | 10 |
5 files changed, 21 insertions, 10 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2a34f15..65c1071 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --no-default-features + args: --no-default-features --features "dsl" - name: Run tests uses: actions-rs/cargo@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 276ac1f..beab444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning][semver]. ## [Unreleased] +### Added +* The re-export of the DSL implementation is gated by the `dsl` feature which is + enabled by default. ### Changed * State transition error is now represented with `TransitionImpossibleError` instead of `()`. @@ -13,11 +13,12 @@ authors = ["Yevhenii Babichenko"] edition = "2018" [features] -default = ["std"] +default = ["std", "dsl"] std = [] +dsl = ["rust-fsm-dsl"] [dependencies] -rust-fsm-dsl = { path = "./rust_fsm_dsl", version = "0.4.0" } +rust-fsm-dsl = { path = "./rust_fsm_dsl", version = "0.4.0", optional = true } [profile.dev] panic = "abort" @@ -30,13 +30,16 @@ of state machines: * A Moore machine by providing an output function that do not depend on the provided inputs. -## Usage in `no_std` environments +## Features This library has the feature named `std` which is enabled by default. You may want to import this library as -`rust-fsm = { version = "0.5", default-features = false }` to use it in a -`no_std` environment. This only affects error types (the `Error` trait is -only available in `std`). +`rust-fsm = { version = "0.5", default-features = false, features = ["dsl"] }` +to use it in a `no_std` environment. This only affects error types (the `Error` +trait is only available in `std`). + +The DSL implementation re-export is gated by the feature named `dsl` which is +also enabled by default. ## Use @@ -31,9 +31,12 @@ //! //! This library has the feature named `std` which is enabled by default. You //! may want to import this library as -//! `rust-fsm = { version = "0.5", default-features = false }` to use it in a -//! `no_std` environment. This only affects error types (the `Error` trait is -//! only available in `std`). +//! `rust-fsm = { version = "0.5", default-features = false, features = ["dsl"] }` +//! to use it in a `no_std` environment. This only affects error types (the +//! `Error` trait is only available in `std`). +//! +//! The DSL implementation re-export is gated by the feature named `dsl` which +//! is also enabled by default. //! //! # Use //! @@ -126,6 +129,7 @@ use core::fmt; #[cfg(feature = "std")] use std::error::Error; +#[cfg(feature = "dsl")] pub use rust_fsm_dsl::state_machine; /// This trait is designed to describe any possible deterministic finite state |