netstack3_base

Trait 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§