Finite state machines in rust; bendns fork to add types.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -149,8 +149,14 @@ where /// Create a new instance of this wrapper which encapsulates the initial /// state. pub fn new() -> Self { + Self::from_state(T::INITIAL_STATE) + } + + /// Create a new instance of this wrapper which encapsulates the given + /// state. + pub fn from_state(state: T::State) -> Self { Self { - state: T::INITIAL_STATE, + state } } |