diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-28 00:47:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-28 00:47:46 +0800 |
| commit | 7ce68cd11516bd7cf037ecea99a92aee7c31b2c3 (patch) | |
| tree | a3923ad41c91aa21fe169fd6b4b1bf8898a82589 /mingling/src/asset/dispatcher.rs | |
Add initial Mingling framework codebase
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); + } +} |
