Skip to main content

Context

Trait Context 

Source
pub trait Context<'ctx>: Sized + Sealed<'ctx> {
    type Merged<Other: Context<'ctx>>: Context<'ctx>;

    // Required methods
    fn from_task<'s>(task_ctx: &'s mut Context<'ctx>) -> &'s mut Self;
    fn unmerge_self<'s, Other: Context<'ctx>>(
        merged: &'s mut Self::Merged<Other>,
    ) -> &'s mut Self;
    fn unmerge_other<'s, Other: Context<'ctx>>(
        merged: &'s mut Self::Merged<Other>,
    ) -> &'s mut Other;
}
Expand description

Context trait for pull-based streams, allowing operators to be generic over synchronous (()) and asynchronous (core::task::Context) execution contexts.

Required Associated Types§

Source

type Merged<Other: Context<'ctx>>: Context<'ctx>

The merged context type when combining two pulls.

Required Methods§

Source

fn from_task<'s>(task_ctx: &'s mut Context<'ctx>) -> &'s mut Self

Creates a context reference from a core::task::Context.

Source

fn unmerge_self<'s, Other: Context<'ctx>>( merged: &'s mut Self::Merged<Other>, ) -> &'s mut Self

Extracts the self-side context from a merged context.

Source

fn unmerge_other<'s, Other: Context<'ctx>>( merged: &'s mut Self::Merged<Other>, ) -> &'s mut Other

Extracts the other-side context from a merged context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'ctx> Context<'ctx> for ()

Source§

type Merged<Other: Context<'ctx>> = Other

Source§

fn from_task<'s>(_task_ctx: &'s mut Context<'ctx>) -> &'s mut Self

Source§

fn unmerge_self<'s, Other: Context<'ctx>>( _merged: &'s mut Self::Merged<Other>, ) -> &'s mut Self

Source§

fn unmerge_other<'s, Other: Context<'ctx>>( merged: &'s mut Self::Merged<Other>, ) -> &'s mut Other

Source§

impl<'ctx> Context<'ctx> for Context<'ctx>

Source§

type Merged<Other: Context<'ctx>> = Context<'ctx>

Source§

fn from_task<'s>(task_ctx: &'s mut Context<'ctx>) -> &'s mut Self

Source§

fn unmerge_self<'s, Other: Context<'ctx>>( merged: &'s mut Self::Merged<Other>, ) -> &'s mut Self

Source§

fn unmerge_other<'s, Other: Context<'ctx>>( merged: &'s mut Self::Merged<Other>, ) -> &'s mut Other

Implementors§