Struct Task

Source
pub struct Task { /* private fields */ }
Expand description

Wrapper for a Future that can be polled by an external single threaded Dart executor.

Implementations§

Source§

impl Task

Source

pub fn spawn(future: LocalBoxFuture<'static, ()>)

Spawns a new Task that will drive the given Future.

Must be called on the same thread where the Task will be polled, otherwise polling will panic.

Source

pub fn poll(&self)

Polls the underlying Future.

Polling after Future’s completion is no-op.

§Panics

If called not on the same thread where this Task was originally created.

Trait Implementations§

Source§

impl ArcWake for Task

Source§

fn wake_by_ref(arc_self: &Arc<Self>)

Commands an external Dart executor to poll this Task if it’s incomplete and there are no Poll::Pending awake requests already.

Source§

fn wake(self: Arc<Self>)

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

impl Debug for Task

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for Task

Task can be sent across threads safely because it ensures that the underlying Future will only be touched from a single thread it was created on.

Source§

impl Sync for Task

Task can be shared across threads safely because it ensures that the underlying Future will only be touched from a single thread it was created on.

Auto Trait Implementations§

§

impl !Freeze for Task

§

impl !RefUnwindSafe for Task

§

impl Unpin for Task

§

impl !UnwindSafe for Task

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, 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<E> WrapTraced<E> for E

Source§

fn wrap_traced(self, f: Frame) -> Traced<E>

Wraps this error into a Traced wrapper, storing the given Frame of a Trace inside.
Source§

impl<T> DartSafe for T

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

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