Struct wd_run::EventManage[][src]

pub struct EventManage<K> where
    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>(&self, key: K, event: E, etype: EType) -> Result<(), String> where
    E: 'static + Event + Sync + Send
[src]

pub fn add_async<E>(&self, key: K, event: E) -> Result<(), String> where
    E: 'static + AsyncEvent + Send
[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>(&self, event: E, ctx: Context) where
    E: 'static + Event + Sync + Send
[src]

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

Auto Trait Implementations

impl<K> !RefUnwindSafe for EventManage<K>

impl<K> Send for EventManage<K> where
    K: Send + Sync

impl<K> Sync for EventManage<K> where
    K: Send + Sync

impl<K> Unpin for EventManage<K>

impl<K> !UnwindSafe for EventManage<K>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.