Struct AsyncTask

Source
pub struct AsyncTask<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O>, O: Default + 'static = ()> { /* private fields */ }
Expand description

异步任务

Implementations§

Source§

impl<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>, O: Default + 'static> AsyncTask<P, O>

Source

pub fn new( uid: TaskId, pool: Arc<P>, priority: usize, future: Option<BoxFuture<'static, O>>, ) -> AsyncTask<P, O>

构建单线程任务

Source

pub fn with_context<C: 'static>( uid: TaskId, pool: Arc<P>, priority: usize, future: Option<BoxFuture<'static, O>>, context: C, ) -> AsyncTask<P, O>

使用指定上下文构建单线程任务

Source

pub fn with_runtime_and_context<RT, C>( runtime: &RT, priority: usize, future: Option<BoxFuture<'static, O>>, context: C, ) -> AsyncTask<P, O>
where RT: AsyncRuntime<O, Pool = P>, C: Send + 'static,

使用指定异步运行时和上下文构建单线程任务

Source

pub fn is_enable_wakeup(&self) -> bool

检查是否允许唤醒

Source

pub fn get_inner(&self) -> Option<BoxFuture<'static, O>>

获取内部任务

Source

pub fn set_inner(&self, inner: Option<BoxFuture<'static, O>>)

设置内部任务

Source

pub fn owner(&self) -> usize

获取任务的所有者

Source

pub fn priority(&self) -> usize

获取异步任务优先级

Source

pub fn exist_context(&self) -> bool

Source

pub fn get_context<C: Send + 'static>(&self) -> Option<&C>

Source

pub fn get_context_mut<C: Send + 'static>(&self) -> Option<&mut C>

Source

pub fn set_context<C: Send + 'static>(&self, new: C)

Source

pub fn get_pool(&self) -> &P

Trait Implementations§

Source§

impl<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O, Pool = P>, O: Default + 'static> ArcWake for AsyncTask<P, O>

Source§

fn wake_by_ref(arc_self: &Arc<Self>)

Indicates that the associated task is ready to make progress and should be polled. Read more
Source§

fn wake(self: Arc<Self>)

Indicates that the associated task is ready to make progress and should be polled. Read more
Source§

impl<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O>, O: Default + 'static> Drop for AsyncTask<P, O>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O>, O: Default + 'static> Send for AsyncTask<P, O>

Source§

impl<P: AsyncTaskPoolExt<O> + AsyncTaskPool<O>, O: Default + 'static> Sync for AsyncTask<P, O>

Auto Trait Implementations§

§

impl<P, O = ()> !Freeze for AsyncTask<P, O>

§

impl<P, O = ()> !RefUnwindSafe for AsyncTask<P, O>

§

impl<P, O> Unpin for AsyncTask<P, O>

§

impl<P, O = ()> !UnwindSafe for AsyncTask<P, O>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ThreadSend for T
where T: Send,

Source§

impl<T> ThreadSync for T
where T: Sync + Send,