pub struct AsyncRuntimeBuilder<O: Default + 'static = ()>(/* private fields */);Expand description
异步运行时构建器
Implementations§
Source§impl<O: Default + 'static> AsyncRuntimeBuilder<O>
impl<O: Default + 'static> AsyncRuntimeBuilder<O>
Sourcepub fn default_worker_thread(
worker_name: Option<&str>,
worker_stack_size: Option<usize>,
worker_sleep_timeout: Option<u64>,
worker_loop_interval: Option<Option<u64>>,
) -> WorkerRuntime<O>
pub fn default_worker_thread( worker_name: Option<&str>, worker_stack_size: Option<usize>, worker_sleep_timeout: Option<u64>, worker_loop_interval: Option<Option<u64>>, ) -> WorkerRuntime<O>
构建默认的工作者异步运行时
Sourcepub fn custom_worker_thread<P, F0, F1>(
pool: P,
worker_handle: Arc<AtomicBool>,
worker_condvar: Arc<(AtomicBool, Mutex<()>, Condvar)>,
thread_name: &str,
thread_stack_size: usize,
sleep_timeout: u64,
loop_interval: Option<u64>,
loop_func: F0,
get_queue_len: F1,
) -> WorkerRuntime<O, P>where
P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>,
F0: Fn() -> (bool, Duration) + Send + 'static,
F1: Fn() -> usize + Send + 'static,
pub fn custom_worker_thread<P, F0, F1>(
pool: P,
worker_handle: Arc<AtomicBool>,
worker_condvar: Arc<(AtomicBool, Mutex<()>, Condvar)>,
thread_name: &str,
thread_stack_size: usize,
sleep_timeout: u64,
loop_interval: Option<u64>,
loop_func: F0,
get_queue_len: F1,
) -> WorkerRuntime<O, P>where
P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>,
F0: Fn() -> (bool, Duration) + Send + 'static,
F1: Fn() -> usize + Send + 'static,
构建自定义的工作者异步运行时
Sourcepub fn default_multi_thread(
worker_prefix: Option<&str>,
worker_stack_size: Option<usize>,
worker_size: Option<usize>,
worker_sleep_timeout: Option<u64>,
) -> MultiTaskRuntime<O>
pub fn default_multi_thread( worker_prefix: Option<&str>, worker_stack_size: Option<usize>, worker_size: Option<usize>, worker_sleep_timeout: Option<u64>, ) -> MultiTaskRuntime<O>
构建默认的多线程异步运行时
Sourcepub fn custom_multi_thread<P>(
pool: P,
worker_prefix: &str,
worker_stack_size: usize,
worker_size: usize,
worker_sleep_timeout: u64,
worker_timer_interval: usize,
) -> MultiTaskRuntime<O, P>where
P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>,
pub fn custom_multi_thread<P>(
pool: P,
worker_prefix: &str,
worker_stack_size: usize,
worker_size: usize,
worker_sleep_timeout: u64,
worker_timer_interval: usize,
) -> MultiTaskRuntime<O, P>where
P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>,
构建自定义的多线程异步运行时
Auto Trait Implementations§
impl<O> Freeze for AsyncRuntimeBuilder<O>
impl<O> RefUnwindSafe for AsyncRuntimeBuilder<O>where
O: RefUnwindSafe,
impl<O> Send for AsyncRuntimeBuilder<O>where
O: Send,
impl<O> Sync for AsyncRuntimeBuilder<O>where
O: Sync,
impl<O> Unpin for AsyncRuntimeBuilder<O>where
O: Unpin,
impl<O> UnwindSafe for AsyncRuntimeBuilder<O>where
O: UnwindSafe,
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