[−][src]Struct wd_event::event::EventManage
Implementations
impl<K> EventManage<K> where
K: Eq + Hash,
[src]
K: Eq + Hash,
pub fn new(conf: EConfig) -> EventManage<K>
[src]
在非async函数中创建
pub async fn new_async(conf: EConfig) -> EventManage<K>
[src]
异步创建
pub fn add<E: Event + Sync + Send + 'static>(
&self,
key: K,
event: E,
etype: EType
) -> Result<(), String>
[src]
&self,
key: K,
event: E,
etype: EType
) -> Result<(), String>
pub fn add_async<E: AsyncEvent + Send + 'static>(
&self,
key: K,
event: E
) -> Result<(), String>
[src]
&self,
key: K,
event: E
) -> Result<(), String>
pub fn remove(&self, key: K) -> Result<(), String>
[src]
pub fn clear(&self) -> Result<(), String>
[src]
pub fn exec_sequence(&self, key: &K, ctx: Option<Context>) -> Result<(), String>
[src]
按顺序执行,先注册的先执行,后注册的后执行。 同一时间一个注册方法只会有一个线程调用。 顺序执行事件,会受到上线文状态影响,失败状态则不再执行后去内容
pub async fn exec_sequence_async<'_, '_>(
&'_ self,
key: &'_ K,
ctx: Option<Context>
) -> Result<(), String>
[src]
&'_ self,
key: &'_ K,
ctx: Option<Context>
) -> Result<(), String>
按顺序执行异步方法,先注册的先执行,后注册的后执行。 同一时间一个注册方法只会有一个线程调用。 顺序执行事件,会受到上线文状态影响,失败状态则不再执行后去内容 该方法在spawn中执行无法通过编译
pub fn exec_pool(&self, key: &K, ctx: Option<Context>)
[src]
加入到任务池中执行,支持多种任务池
pub async fn exec_immediately<'_, '_>(
&'_ self,
key: &'_ K,
ctx: Option<Context>
)
[src]
&'_ self,
key: &'_ K,
ctx: Option<Context>
)
立即进行异步执行,速度更快,开启任务的开销较小
pub fn delay_exec<E: Event + Sync + Send + 'static>(
&self,
event: E,
ctx: Context
)
[src]
&self,
event: E,
ctx: Context
)
pub fn delay_exec_async<E: AsyncEvent + Send + 'static>(
&self,
event: E,
ctx: Context
)
[src]
&self,
event: E,
ctx: Context
)
Auto Trait Implementations
impl<K> !RefUnwindSafe for EventManage<K>
[src]
impl<K> Send for EventManage<K> where
K: Send + Sync,
[src]
K: Send + Sync,
impl<K> Sync for EventManage<K> where
K: Send + Sync,
[src]
K: Send + Sync,
impl<K> Unpin for EventManage<K>
[src]
impl<K> !UnwindSafe for EventManage<K>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,