use bevy::ecs::{
define_label,
intern::Interned,
system::{
self,
System,
},
};
use thiserror::Error;
mod ext;
pub mod pathway;
mod registry;
mod systems;
pub use self::{
ext::AppFlowExt,
registry::Flows,
systems::{
Flow,
IntoFlowSystems,
},
};
#[derive(Error, Debug)]
pub enum FlowError {
#[error("could not find `AppTypeRegistry`")]
NoTypeRegistry,
#[error("No flows with input `{0:?}` found")]
NotRegistered(&'static str),
#[error("the flow `{0:?}` was not registered")]
NotFound(InternedFlowLabel),
}
pub type FlowSystem<In> = Box<dyn System<In = system::In<In>, Out = In>>;
define_label!(
#[diagnostic::on_unimplemented(
note = "consider annotating `{Self}` with `#[derive(FlowLabel)]`"
)]
FlowLabel,
FLOW_LABEL_INTERNER
);
pub type InternedFlowLabel = Interned<dyn FlowLabel>;