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) -> CtxPair<CC, BC>where
BC: Default,
pub fn with_core_ctx(core_ctx: CC) -> CtxPair<CC, BC>where
BC: Default,
Creates a new CtxPair
with core_ctx
and a default bindings context.
Sourcepub fn with_default_bindings_ctx<F>(builder: F) -> CtxPair<CC, BC>
pub fn with_default_bindings_ctx<F>(builder: F) -> CtxPair<CC, BC>
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 as BuildableCoreContext<BC>>::Builder,
) -> CtxPair<CC, BC>where
CC: BuildableCoreContext<BC>,
BC: Default,
pub fn new_with_builder(
builder: <CC as BuildableCoreContext<BC>>::Builder,
) -> CtxPair<CC, BC>where
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,
Source§type CoreContext = <CC as ContextProvider>::Context
type CoreContext = <CC as ContextProvider>::Context
The core context type held by this pair.
Source§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 <CtxPair<CC, BC> as ContextPair>::CoreContext, &mut <CtxPair<CC, BC> as ContextPair>::BindingsContext)
fn contexts( &mut self, ) -> (&mut <CtxPair<CC, BC> as ContextPair>::CoreContext, &mut <CtxPair<CC, BC> as ContextPair>::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§unsafe fn clone_to_uninit(&self, dst: *mut T)
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
Source§impl<L, T> UnlockedAccess<L> for Twhere
L: UnlockedAccessMarkerFor<T>,
impl<L, T> UnlockedAccess<L> for Twhere
L: UnlockedAccessMarkerFor<T>,
Source§type Data = <L as UnlockedAccessMarkerFor<T>>::Data
type Data = <L as UnlockedAccessMarkerFor<T>>::Data
The type of state being accessed.
Source§type Guard<'l> = &'l <L as UnlockedAccessMarkerFor<T>>::Data
where
T: 'l
type Guard<'l> = &'l <L as UnlockedAccessMarkerFor<T>>::Data where T: 'l
A guard providing read access to the data.
Source§fn access(&self) -> <T as UnlockedAccess<L>>::Guard<'_>
fn access(&self) -> <T as UnlockedAccess<L>>::Guard<'_>
How to access the state.