Trait Context

Source
pub trait Context {
    type Ctx: RawContext;

    // Required methods
    fn ctx(&self) -> Self::Ctx;
    fn ctx_mut(&mut self) -> &mut Self::Ctx;
    fn replace_ctx(&mut self, ctx: Self::Ctx) -> Self::Ctx;
    fn set_ctx(&mut self, ctx: Self::Ctx) -> &mut Self;
}

Required Associated Types§

Required Methods§

Source

fn ctx(&self) -> Self::Ctx

returns an immutable reference to the current context.

Source

fn ctx_mut(&mut self) -> &mut Self::Ctx

returns a mutable reference to the current context

Source

fn replace_ctx(&mut self, ctx: Self::Ctx) -> Self::Ctx

replace the current context with the given before returning the previous entry.

Source

fn set_ctx(&mut self, ctx: Self::Ctx) -> &mut Self

update the current instance with the given context before returning a mutable reference

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.

Implementors§