[][src]Struct wd_event::event::EventManage

pub struct EventManage<K: Eq + Hash> { /* fields omitted */ }

Implementations

impl<K> EventManage<K> where
    K: Eq + Hash
[src]

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]

pub fn add_async<E: AsyncEvent + Send + 'static>(
    &self,
    key: K,
    event: E
) -> Result<(), String>
[src]

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]

按顺序执行异步方法,先注册的先执行,后注册的后执行。 同一时间一个注册方法只会有一个线程调用。 顺序执行事件,会受到上线文状态影响,失败状态则不再执行后去内容 该方法在spawn中执行无法通过编译

pub fn exec_pool(&self, key: &K, ctx: Option<Context>)[src]

加入到任务池中执行,支持多种任务池

pub async fn exec_immediately<'_, '_>(
    &'_ self,
    key: &'_ K,
    ctx: Option<Context>
)
[src]

立即进行异步执行,速度更快,开启任务的开销较小

pub fn delay_exec<E: Event + Sync + Send + 'static>(
    &self,
    event: E,
    ctx: Context
)
[src]

pub fn delay_exec_async<E: AsyncEvent + Send + 'static>(
    &self,
    event: E,
    ctx: Context
)
[src]

Auto Trait Implementations

impl<K> !RefUnwindSafe for EventManage<K>[src]

impl<K> Send for EventManage<K> where
    K: Send + Sync
[src]

impl<K> Sync for EventManage<K> where
    K: Send + Sync
[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.