From 240361b240d638363346013160b0943b47769c37 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 8 Apr 2026 22:48:31 +0800 Subject: Implement mingling::this function --- mingling_core/src/asset/dispatcher.rs | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'mingling_core/src/asset') diff --git a/mingling_core/src/asset/dispatcher.rs b/mingling_core/src/asset/dispatcher.rs index 86dfe7c..0f4675c 100644 --- a/mingling_core/src/asset/dispatcher.rs +++ b/mingling_core/src/asset/dispatcher.rs @@ -34,7 +34,7 @@ impl Program { /// Adds a dispatcher to the program. pub fn with_dispatcher(&mut self, dispatcher: Disp) where - Disp: Dispatcher + 'static, + Disp: Dispatcher + Send + Sync + 'static, { self.dispatcher.push(Box::new(dispatcher)); } @@ -60,17 +60,17 @@ impl Program { /// allowing multiple dispatchers to be grouped together and passed /// to the program via `Program::with_dispatchers`. pub struct Dispatchers { - dispatcher: Vec + 'static>>, + dispatcher: Vec + Send + Sync + 'static>>, } -impl From>>> for Dispatchers { - fn from(dispatcher: Vec>>) -> Self { +impl From + Send + Sync>>> for Dispatchers { + fn from(dispatcher: Vec + Send + Sync>>) -> Self { Self { dispatcher } } } -impl From>> for Dispatchers { - fn from(dispatcher: Box>) -> Self { +impl From + Send + Sync>> for Dispatchers { + fn from(dispatcher: Box + Send + Sync>) -> Self { Self { dispatcher: vec![dispatcher], } @@ -79,7 +79,7 @@ impl From>> for Dispatchers { impl From<(D,)> for Dispatchers where - D: Dispatcher + 'static, + D: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatcher: (D,)) -> Self { @@ -91,8 +91,8 @@ where impl From<(D1, D2)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2)) -> Self { @@ -104,9 +104,9 @@ where impl From<(D1, D2, D3)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, - D3: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, + D3: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2, D3)) -> Self { @@ -122,10 +122,10 @@ where impl From<(D1, D2, D3, D4)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, - D3: Dispatcher + 'static, - D4: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, + D3: Dispatcher + Send + Sync + 'static, + D4: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2, D3, D4)) -> Self { @@ -142,11 +142,11 @@ where impl From<(D1, D2, D3, D4, D5)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, - D3: Dispatcher + 'static, - D4: Dispatcher + 'static, - D5: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, + D3: Dispatcher + Send + Sync + 'static, + D4: Dispatcher + Send + Sync + 'static, + D5: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2, D3, D4, D5)) -> Self { @@ -164,12 +164,12 @@ where impl From<(D1, D2, D3, D4, D5, D6)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, - D3: Dispatcher + 'static, - D4: Dispatcher + 'static, - D5: Dispatcher + 'static, - D6: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, + D3: Dispatcher + Send + Sync + 'static, + D4: Dispatcher + Send + Sync + 'static, + D5: Dispatcher + Send + Sync + 'static, + D6: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2, D3, D4, D5, D6)) -> Self { @@ -188,13 +188,13 @@ where impl From<(D1, D2, D3, D4, D5, D6, D7)> for Dispatchers where - D1: Dispatcher + 'static, - D2: Dispatcher + 'static, - D3: Dispatcher + 'static, - D4: Dispatcher + 'static, - D5: Dispatcher + 'static, - D6: Dispatcher + 'static, - D7: Dispatcher + 'static, + D1: Dispatcher + Send + Sync + 'static, + D2: Dispatcher + Send + Sync + 'static, + D3: Dispatcher + Send + Sync + 'static, + D4: Dispatcher + Send + Sync + 'static, + D5: Dispatcher + Send + Sync + 'static, + D6: Dispatcher + Send + Sync + 'static, + D7: Dispatcher + Send + Sync + 'static, G: Display, { fn from(dispatchers: (D1, D2, D3, D4, D5, D6, D7)) -> Self { @@ -213,14 +213,14 @@ where } impl std::ops::Deref for Dispatchers { - type Target = Vec + 'static>>; + type Target = Vec + Send + Sync + 'static>>; fn deref(&self) -> &Self::Target { &self.dispatcher } } -impl From> for Vec + 'static>> { +impl From> for Vec + Send + Sync + 'static>> { fn from(val: Dispatchers) -> Self { val.dispatcher } -- cgit