RawTask

Struct RawTask 

Source
pub(crate) struct RawTask<F, T, S, M> {
    pub(crate) header: *const Header<M>,
    pub(crate) schedule: *const S,
    pub(crate) future: *mut F,
    pub(crate) output: *mut Result<T, Box<dyn Any + Send + 'static>>,
}
Expand description

Raw pointers to the fields inside a task.

Fields§

§header: *const Header<M>

The task header.

§schedule: *const S

The schedule function.

§future: *mut F

The future.

§output: *mut Result<T, Box<dyn Any + Send + 'static>>

The output of the future.

Implementations§

Source§

impl<F, T, S, M> RawTask<F, T, S, M>

Source

const TASK_LAYOUT: TaskLayout

Source

const fn eval_task_layout() -> TaskLayout

Computes the memory layout for a task.

Source§

impl<F, T, S, M> RawTask<F, T, S, M>
where F: Future<Output = T>, S: Schedule<M>,

Source

const RAW_WAKER_VTABLE: RawWakerVTable

Source

pub(crate) fn allocate<'a, Gen: FnOnce(&'a M) -> F>( future: Gen, schedule: S, builder: Builder<M>, ) -> NonNull<()>
where F: 'a, M: 'a,

Allocates a task with the given future and schedule function.

It is assumed that initially only the Runnable and the Task exist.

Source

pub(crate) fn from_ptr(ptr: *const ()) -> Self

Creates a RawTask from a raw task pointer.

Source

fn task_layout() -> TaskLayout

Returns the layout of the task.

Source

unsafe fn wake(ptr: *const ())

Wakes a waker.

Source

unsafe fn wake_by_ref(ptr: *const ())

Wakes a waker by reference.

Source

unsafe fn clone_waker(ptr: *const ()) -> RawWaker

Clones a waker.

Source

unsafe fn drop_waker(ptr: *const ())

Drops a waker.

This function will decrement the reference count. If it drops down to zero, the associated Task has been dropped too, and the task has not been completed, then it will get scheduled one more time so that its future gets dropped by the executor.

Source

unsafe fn drop_ref(ptr: *const ())

Drops a task reference (Runnable or Waker).

This function will decrement the reference count. If it drops down to zero and the associated Task handle has been dropped too, then the task gets destroyed.

Source

unsafe fn schedule(ptr: *const (), info: ScheduleInfo)

Schedules a task for running.

This function doesn’t modify the state of the task. It only passes the task reference to its schedule function.

Source

unsafe fn drop_future(ptr: *const ())

Drops the future inside a task.

Source

unsafe fn get_output(ptr: *const ()) -> *const ()

Returns a pointer to the output inside a task.

Source

unsafe fn destroy(ptr: *const ())

Cleans up task’s resources and deallocates it.

The schedule function will be dropped, and the task will then get deallocated. The task must be closed before this function is called.

Source

unsafe fn run(ptr: *const ()) -> bool

Runs a task.

If polling its future panics, the task will be closed and the panic will be propagated into the caller.

Trait Implementations§

Source§

impl<F, T, S, M> Clone for RawTask<F, T, S, M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F, T, S, M> Copy for RawTask<F, T, S, M>

Auto Trait Implementations§

§

impl<F, T, S, M> Freeze for RawTask<F, T, S, M>

§

impl<F, T, S, M> !RefUnwindSafe for RawTask<F, T, S, M>

§

impl<F, T, S, M> !Send for RawTask<F, T, S, M>

§

impl<F, T, S, M> !Sync for RawTask<F, T, S, M>

§

impl<F, T, S, M> Unpin for RawTask<F, T, S, M>

§

impl<F, T, S, M> !UnwindSafe for RawTask<F, T, S, M>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.