Trait netstack3_base::ContextPair

source ·
pub trait ContextPair {
    type CoreContext;
    type BindingsContext;

    // Required method
    fn contexts(
        &mut self,
    ) -> (&mut Self::CoreContext, &mut Self::BindingsContext);

    // Provided methods
    fn core_ctx(&mut self) -> &mut Self::CoreContext { ... }
    fn bindings_ctx(&mut self) -> &mut Self::BindingsContext { ... }
}
Expand description

A pair of core and bindings contexts.

This trait exists so implementers can be agnostic on the storage of the contexts, since all we need from a context pair is mutable references from both contexts.

Required Associated Types§

source

type CoreContext

The core context type held by this pair.

source

type BindingsContext

The bindings context type held by this pair.

Required Methods§

source

fn contexts(&mut self) -> (&mut Self::CoreContext, &mut Self::BindingsContext)

Gets a mutable reference to both contexts.

Provided Methods§

source

fn core_ctx(&mut self) -> &mut Self::CoreContext

Gets a mutable reference to the core context.

source

fn bindings_ctx(&mut self) -> &mut Self::BindingsContext

Gets a mutable reference to the bindings context.

Implementations on Foreign Types§

source§

impl<'a, C> ContextPair for &'a mut C
where C: ContextPair,

Implementors§