pub struct TaskManager { /* private fields */ }Implementations§
Source§impl TaskManager
impl TaskManager
pub fn new(thread_count: usize) -> Self
pub fn from_handle(handle: Handle) -> Self
pub fn add_task<T: FnOnce() + Send + 'static>(&self, task: T)
Sourcepub fn add_task_async<R: Send + 'static, T: Future<Output = R> + Send + 'static>(
&self,
task: T,
) -> impl Future<Output = Result<R, JoinError>>
pub fn add_task_async<R: Send + 'static, T: Future<Output = R> + Send + 'static>( &self, task: T, ) -> impl Future<Output = Result<R, JoinError>>
start an async task
§Example
use hirofa_utils::task_manager::TaskManager;
let tm = TaskManager::new(2);
let task = async {
println!("foo");
};
tm.add_task_async(task);pub fn run_task_blocking<R: Send + 'static, T: FnOnce() -> R + Send + 'static>( &self, task: T, ) -> R
Auto Trait Implementations§
impl !Freeze for TaskManager
impl RefUnwindSafe for TaskManager
impl Send for TaskManager
impl Sync for TaskManager
impl Unpin for TaskManager
impl UnsafeUnpin for TaskManager
impl UnwindSafe for TaskManager
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