pub struct TaskRef { /* private fields */ }Expand description
Reference-counted task handle
Similar to Theseus’s TaskRef, this provides safe reference counting for task structures.
Implementations§
Source§impl TaskRef
impl TaskRef
Sourcepub unsafe fn new(task_ptr: *mut TaskInner) -> Self
pub unsafe fn new(task_ptr: *mut TaskInner) -> Self
Creates a new TaskRef from a raw task pointer
§Safety
- The task_ptr must be valid for the lifetime of the process
- The caller must ensure proper synchronization
Sourcepub unsafe fn as_mut(&mut self) -> &mut TaskInner
pub unsafe fn as_mut(&mut self) -> &mut TaskInner
Returns a mutable reference to the inner task
§Safety
The caller must ensure exclusive access to the task
Sourcepub fn is_last_ref(&self) -> bool
pub fn is_last_ref(&self) -> bool
Returns true if this is the last reference
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskRef
impl !RefUnwindSafe for TaskRef
impl Unpin for TaskRef
impl UnsafeUnpin for TaskRef
impl !UnwindSafe for TaskRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more