use crate::Router;
/// An action context, describing any additional context that the action may carry.
/// This is used to distribute system setup information when invoking them as actions,
/// for example, when systems have defined action routes.
#[derive(Clone, Debug, Default)]
pub enum ActionContext<State> {
/// The action is being invoked as a single unit.
#[default]
Unit,
/// The action is a collection of actions.
System(SystemContext<State>),
}
impl<State> From<SystemContext<State>> for ActionContext<State> {
fn from(context: SystemContext<State>) -> Self {
Self::System(context)
}
}
/// A router for actions that can be invoked as services.
#[derive(Clone, Debug, Default)]
pub struct SystemContext<State> {
/// Any routes that have been mounted on a routed system.
pub router: Router<State>,
}
impl<State> From<Router<State>> for SystemContext<State> {
fn from(router: Router<State>) -> Self {
Self { router }
}
}