diff options
Diffstat (limited to 'mingling/src/asset/dispatcher.rs')
| -rw-r--r-- | mingling/src/asset/dispatcher.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mingling/src/asset/dispatcher.rs b/mingling/src/asset/dispatcher.rs new file mode 100644 index 0000000..31623d3 --- /dev/null +++ b/mingling/src/asset/dispatcher.rs @@ -0,0 +1,19 @@ +use crate::{ChainProcess, Program, asset::node::Node}; + +pub use mingling_macros::Dispatcher; + +pub trait Dispatcher { + fn node(&self) -> Node; +} + +pub trait DispatcherChain { + fn begin(&self) -> ChainProcess; +} + +impl Program { + /// Adds a dispatcher to the program. + pub fn with_dispatcher<D: Dispatcher + 'static>(&mut self, dispatcher: D) { + let dispatcher = Box::new(dispatcher); + self.dispatcher.push(dispatcher); + } +} |
