pub struct Context(/* private fields */);Expand description
Implementations§
Source§impl Context
impl Context
pub fn acquire(context_name: &str, wait: Duration) -> Result<Self, Error>
pub fn downgrade(&self) -> ContextWeak
pub fn name(&self) -> &str
pub fn wait_duration(&self) -> Duration
Sourcepub fn is_context_thread() -> bool
pub fn is_context_thread() -> bool
Returns true if a Context is running on current thread.
Sourcepub fn current_task() -> Option<(Context, TaskId)>
pub fn current_task() -> Option<(Context, TaskId)>
Returns the TaskId running on current thread, if any.
pub fn spawn<Fut>(&self, future: Fut) -> JoinHandle<Fut::Output> ⓘ
pub fn spawn_and_unpark<Fut>(&self, future: Fut) -> JoinHandle<Fut::Output> ⓘ
pub fn add_sub_task<T>(&self, task_id: TaskId, sub_task: T) -> Result<(), T>
pub async fn drain_sub_tasks() -> SubTaskOutput
Trait Implementations§
impl Eq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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