#[non_exhaustive]pub enum LifecycleError<M> {
TransitionDenied {
from: M,
to: M,
reason: &'static str,
},
}Expand description
Errors that can occur during lifecycle operations.
All variants include enough context to diagnose the failure without
a debugger. Uses #[non_exhaustive] so new variants can be added
in minor versions without breaking downstream code.
§Examples
use ready_active_safe::LifecycleError;
let err: LifecycleError<&str> = LifecycleError::TransitionDenied {
from: "active",
to: "ready",
reason: "backward transitions are not allowed",
};
assert_eq!(
err.to_string(),
"transition denied from active to ready: backward transitions are not allowed",
);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
Source§impl<M: Clone> Clone for LifecycleError<M>
impl<M: Clone> Clone for LifecycleError<M>
Source§fn clone(&self) -> LifecycleError<M>
fn clone(&self) -> LifecycleError<M>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<M: Debug> Debug for LifecycleError<M>
impl<M: Debug> Debug for LifecycleError<M>
Source§impl<M: Display> Display for LifecycleError<M>
impl<M: Display> Display for LifecycleError<M>
Source§impl<M: Debug + Display> Error for LifecycleError<M>
Available on crate feature std only.
impl<M: Debug + Display> Error for LifecycleError<M>
Available on crate feature
std only.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()
Source§impl<M: PartialEq> PartialEq for LifecycleError<M>
impl<M: PartialEq> PartialEq for LifecycleError<M>
impl<M: Eq> Eq for LifecycleError<M>
impl<M> StructuralPartialEq for LifecycleError<M>
Auto Trait Implementations§
impl<M> Freeze for LifecycleError<M>where
M: Freeze,
impl<M> RefUnwindSafe for LifecycleError<M>where
M: RefUnwindSafe,
impl<M> Send for LifecycleError<M>where
M: Send,
impl<M> Sync for LifecycleError<M>where
M: Sync,
impl<M> Unpin for LifecycleError<M>where
M: Unpin,
impl<M> UnsafeUnpin for LifecycleError<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for LifecycleError<M>where
M: 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