pub struct FnTask<F, I, O, Fut>(/* private fields */);Expand description
Wrapper that enables closures to implement CoreTask.
Use the fn_task helper function to create instances with inferred types.
§Example
ⓘ
use sayiir_core::task::fn_task;
// Both work with the same `register` method:
registry.register("closure", codec.clone(), fn_task(|i: u32| async move { Ok(i * 2) }));
registry.register("struct", codec.clone(), MyTask::new());Trait Implementations§
Auto Trait Implementations§
impl<F, I, O, Fut> Freeze for FnTask<F, I, O, Fut>where
F: Freeze,
impl<F, I, O, Fut> RefUnwindSafe for FnTask<F, I, O, Fut>where
F: RefUnwindSafe,
impl<F, I, O, Fut> Send for FnTask<F, I, O, Fut>where
F: Send,
impl<F, I, O, Fut> Sync for FnTask<F, I, O, Fut>where
F: Sync,
impl<F, I, O, Fut> Unpin for FnTask<F, I, O, Fut>where
F: Unpin,
impl<F, I, O, Fut> UnsafeUnpin for FnTask<F, I, O, Fut>where
F: UnsafeUnpin,
impl<F, I, O, Fut> UnwindSafe for FnTask<F, I, O, Fut>where
F: 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