pub struct LocalTaskRunner<O: Default + 'static = ()>(/* private fields */);Expand description
本地异步任务执行器
Implementations§
Source§impl<O: Default + 'static> LocalTaskRunner<O>
impl<O: Default + 'static> LocalTaskRunner<O>
Sourcepub fn with_poll(poller: Arc<Poller>) -> Self
pub fn with_poll(poller: Arc<Poller>) -> Self
构建一个指定了Poller的本地异步任务执行器 注意当异步任务执行器在运行时,外部不允许使用wait方法
Sourcepub fn is_with_polling(&self) -> bool
pub fn is_with_polling(&self) -> bool
判断是指定使用Poll
Sourcepub fn get_runtime(&self) -> LocalTaskRuntime<O>
pub fn get_runtime(&self) -> LocalTaskRuntime<O>
获取当前本地异步任务执行器的运行时
Sourcepub fn startup(
self,
thread_name: &str,
thread_stack_size: usize,
) -> LocalTaskRuntime<O>
pub fn startup( self, thread_name: &str, thread_stack_size: usize, ) -> LocalTaskRuntime<O>
启动工作者异步任务执行器
Sourcepub fn startup_with_poll(
self,
thread_name: &str,
thread_stack_size: usize,
try_count: usize,
timeout: Option<Duration>,
) -> LocalTaskRuntime<O>
pub fn startup_with_poll( self, thread_name: &str, thread_stack_size: usize, try_count: usize, timeout: Option<Duration>, ) -> LocalTaskRuntime<O>
启动设置了Poller的工作者异步任务执行器
Sourcepub fn try_sleep(
&self,
try_count: usize,
timeout: Option<Duration>,
) -> IOResult<Option<usize>>
pub fn try_sleep( &self, try_count: usize, timeout: Option<Duration>, ) -> IOResult<Option<usize>>
尝试休眠当前推动运行时的线程,并在派发新任务或休眠超时后唤醒 返回Some表示还需要至少多少次尝试以后才可能休眠 注意休眠只在设置了Poller后有效,且在执行run_once后调用
Sourcepub fn into_local(self) -> LocalTaskRuntime<O>
pub fn into_local(self) -> LocalTaskRuntime<O>
转换为本地异步任务运行时
Trait Implementations§
impl<O: Default + 'static> Send for LocalTaskRunner<O>
impl<O: Default + 'static> !Sync for LocalTaskRunner<O>
Auto Trait Implementations§
impl<O> Freeze for LocalTaskRunner<O>
impl<O = ()> !RefUnwindSafe for LocalTaskRunner<O>
impl<O> Unpin for LocalTaskRunner<O>
impl<O = ()> !UnwindSafe for LocalTaskRunner<O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more