pub enum ValidationError<S, E> {
InvalidStateIndex {
expected: usize,
got: usize,
},
InvalidEventIndex {
expected: usize,
got: usize,
},
NoInitialState,
UndefinedTransition {
from: S,
event: E,
},
}Expand description
Errors that can occur during state machine validation.
These errors are returned by StateMachineBuilder::build
when the state machine configuration is invalid.
§Example
use tinystate::{StateMachineBuilder, ValidationError};
// Missing initial state will cause an error
let result = StateMachineBuilder::<S, E, 1, 1>::new()
.self_loop(S::A, E::X)
.build();
assert!(result.is_err());Variants§
InvalidStateIndex
A state’s index does not match its expected position.
InvalidEventIndex
An event’s index does not match its expected position.
NoInitialState
No initial state was set before building.
UndefinedTransition
A required state transition was not defined.
Trait Implementations§
Source§impl<S: States + Debug, E: Events + Debug> Error for ValidationError<S, E>
impl<S: States + Debug, E: Events + Debug> Error for ValidationError<S, E>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<S, E> Freeze for ValidationError<S, E>
impl<S, E> RefUnwindSafe for ValidationError<S, E>where
S: RefUnwindSafe,
E: RefUnwindSafe,
impl<S, E> Send for ValidationError<S, E>
impl<S, E> Sync for ValidationError<S, E>
impl<S, E> Unpin for ValidationError<S, E>
impl<S, E> UnwindSafe for ValidationError<S, E>where
S: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more