Struct netstack3_base::CtxPair
source · pub struct CtxPair<CC, BC> {
pub core_ctx: CC,
pub bindings_ctx: BC,
}
Expand description
A concrete implementation of ContextPair
.
CtxPair
provides a ContextPair
implementation when CC
and BC
are
ContextProvider
and using their respective targets as the CoreContext
and BindingsContext
associated types.
Fields§
§core_ctx: CC
The core context.
bindings_ctx: BC
The bindings context.
Implementations§
source§impl<CC, BC> CtxPair<CC, BC>
impl<CC, BC> CtxPair<CC, BC>
sourcepub fn with_core_ctx(core_ctx: CC) -> Selfwhere
BC: Default,
pub fn with_core_ctx(core_ctx: CC) -> Selfwhere
BC: Default,
Creates a new CtxPair
with core_ctx
and a default bindings context.
sourcepub fn with_default_bindings_ctx<F: FnOnce(&mut BC) -> CC>(builder: F) -> Selfwhere
BC: Default,
pub fn with_default_bindings_ctx<F: FnOnce(&mut BC) -> CC>(builder: F) -> Selfwhere
BC: Default,
Creates a new CtxPair
with a default bindings context and a core
context resulting from builder
.
sourcepub fn as_mut(&mut self) -> CtxPair<&mut CC, &mut BC>
pub fn as_mut(&mut self) -> CtxPair<&mut CC, &mut BC>
Creates a new CtxPair
with a mutable borrow of the contexts.
sourcepub fn new_with_builder(builder: CC::Builder) -> Selfwhere
CC: BuildableCoreContext<BC>,
BC: Default,
pub fn new_with_builder(builder: CC::Builder) -> Selfwhere
CC: BuildableCoreContext<BC>,
BC: Default,
Creates a new CtxPair
with a default bindings context and the provided
core context builder.
Trait Implementations§
source§impl<CC, BC> ContextPair for CtxPair<CC, BC>where
CC: ContextProvider,
BC: ContextProvider,
impl<CC, BC> ContextPair for CtxPair<CC, BC>where
CC: ContextProvider,
BC: ContextProvider,
§type CoreContext = <CC as ContextProvider>::Context
type CoreContext = <CC as ContextProvider>::Context
The core context type held by this pair.
§type BindingsContext = <BC as ContextProvider>::Context
type BindingsContext = <BC as ContextProvider>::Context
The bindings context type held by this pair.
source§fn contexts(&mut self) -> (&mut Self::CoreContext, &mut Self::BindingsContext)
fn contexts(&mut self) -> (&mut Self::CoreContext, &mut Self::BindingsContext)
Gets a mutable reference to both contexts.
source§fn core_ctx(&mut self) -> &mut Self::CoreContext
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
fn bindings_ctx(&mut self) -> &mut Self::BindingsContext
Gets a mutable reference to the bindings context.
Auto Trait Implementations§
impl<CC, BC> Freeze for CtxPair<CC, BC>
impl<CC, BC> RefUnwindSafe for CtxPair<CC, BC>where
CC: RefUnwindSafe,
BC: RefUnwindSafe,
impl<CC, BC> Send for CtxPair<CC, BC>
impl<CC, BC> Sync for CtxPair<CC, BC>
impl<CC, BC> Unpin for CtxPair<CC, BC>
impl<CC, BC> UnwindSafe for CtxPair<CC, BC>where
CC: UnwindSafe,
BC: UnwindSafe,
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<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
impl<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
Send a frame. Read more
source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more