pub trait Lifecycle {
type Key: Hash + Eq + Clone + Serialize + DeserializeOwned;
type State;
type Context;
type Output;
type Error;
// Required methods
fn key(&self) -> Self::Key;
fn enter(
self,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<Self::State, Self::Error>;
fn reconcile_self(
self,
state: &mut Self::State,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<(), Self::Error>;
fn exit(
state: Self::State,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<(), Self::Error>;
// Provided methods
fn display_name(&self) -> String { ... }
fn enhance_lifecycle_context(&self, _ctx: &mut LifecycleContext) { ... }
fn enhance_lifecycle_state_context(
_state: &Self::State,
_ctx: &mut LifecycleContext,
) { ... }
fn lifecycle_context(&self) -> LifecycleContext { ... }
fn lifecycle_state_context(state: &Self::State) -> LifecycleContext { ... }
fn wrap_enter(
self,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<Self::State, Self::Error>
where Self: Sized { ... }
fn wrap_reconcile(
self,
state: &mut Self::State,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<(), Self::Error>
where Self: Sized { ... }
fn wrap_exit(
state: Self::State,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<(), Self::Error> { ... }
}Required Associated Types§
type Key: Hash + Eq + Clone + Serialize + DeserializeOwned
type State
type Context
type Output
type Error
Required Methods§
fn key(&self) -> Self::Key
fn enter( self, ctx: &mut Self::Context, output: &mut Self::Output, ) -> Result<Self::State, Self::Error>
fn reconcile_self( self, state: &mut Self::State, ctx: &mut Self::Context, output: &mut Self::Output, ) -> Result<(), Self::Error>
fn exit( state: Self::State, ctx: &mut Self::Context, output: &mut Self::Output, ) -> Result<(), Self::Error>
Provided Methods§
Sourcefn display_name(&self) -> String
fn display_name(&self) -> String
Human-readable label for logs and traces. Defaults to empty; override
when you want lifecycle events to identify themselves by something
other than key.
fn enhance_lifecycle_context(&self, _ctx: &mut LifecycleContext)
fn enhance_lifecycle_state_context( _state: &Self::State, _ctx: &mut LifecycleContext, )
fn lifecycle_context(&self) -> LifecycleContext
fn lifecycle_state_context(state: &Self::State) -> LifecycleContext
fn wrap_enter(
self,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<Self::State, Self::Error>where
Self: Sized,
fn wrap_reconcile(
self,
state: &mut Self::State,
ctx: &mut Self::Context,
output: &mut Self::Output,
) -> Result<(), Self::Error>where
Self: Sized,
fn wrap_exit( state: Self::State, ctx: &mut Self::Context, output: &mut Self::Output, ) -> Result<(), Self::Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.