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: CCThe core context.
bindings_ctx: BCThe 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.
Source§impl<CC, BC> CtxPairExt<BC> for CtxPair<CC, BC>
impl<CC, BC> CtxPairExt<BC> for CtxPair<CC, BC>
Source§fn contexts(&mut self) -> (UnlockedCoreCtx<'_, BC>, &mut BC)
fn contexts(&mut self) -> (UnlockedCoreCtx<'_, BC>, &mut BC)
Retrieves the core and bindings context, respectively. Read more
Source§fn core_ctx(&self) -> UnlockedCoreCtx<'_, BC>
fn core_ctx(&self) -> UnlockedCoreCtx<'_, BC>
Like
CtxPairExt::contexts, but retrieves only the core context.Source§fn trigger_next_timer<Id>(&mut self) -> Option<Id>
fn trigger_next_timer<Id>(&mut self) -> Option<Id>
Shortcut for
FakeTimerCtxExt::trigger_next_timer.Source§fn trigger_timers_for<Id>(&mut self, duration: Duration) -> Vec<Id>
fn trigger_timers_for<Id>(&mut self, duration: Duration) -> Vec<Id>
Shortcut for
FakeTimerCtxExt::trigger_timers_for.Source§fn trigger_timers_until_instant<Id>(&mut self, instant: FakeInstant) -> Vec<Id>
fn trigger_timers_until_instant<Id>(&mut self, instant: FakeInstant) -> Vec<Id>
Shortcut for [
FaketimerCtx::trigger_timers_until_instant].Source§fn trigger_timers_until_and_expect_unordered<Id, I: IntoIterator<Item = Id>>(
&mut self,
instant: FakeInstant,
timers: I,
)where
Id: Debug + Hash + Eq,
BC: FakeTimerCtxExt<Id>,
for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id>,
fn trigger_timers_until_and_expect_unordered<Id, I: IntoIterator<Item = Id>>(
&mut self,
instant: FakeInstant,
timers: I,
)where
Id: Debug + Hash + Eq,
BC: FakeTimerCtxExt<Id>,
for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id>,
Source§impl<CC, BC> Default for CtxPair<CC, BC>where
CC: BuildableCoreContext<BC>,
<CC as BuildableCoreContext<BC>>::Builder: Default,
BC: Default,
impl<CC, BC> Default for CtxPair<CC, BC>where
CC: BuildableCoreContext<BC>,
<CC as BuildableCoreContext<BC>>::Builder: Default,
BC: Default,
Source§impl<TimerId, CC, BC> WithFakeTimerContext<TimerId> for CtxPair<CC, BC>where
BC: WithFakeTimerContext<TimerId>,
impl<TimerId, CC, BC> WithFakeTimerContext<TimerId> for CtxPair<CC, BC>where
BC: WithFakeTimerContext<TimerId>,
Source§fn with_fake_timer_ctx<O, F>(&self, f: F) -> Owhere
F: FnOnce(&FakeTimerCtx<TimerId>) -> O,
fn with_fake_timer_ctx<O, F>(&self, f: F) -> Owhere
F: FnOnce(&FakeTimerCtx<TimerId>) -> O,
Calls the callback with a borrow of
FakeTimerCtx.Source§fn with_fake_timer_ctx_mut<O, F>(&mut self, f: F) -> Owhere
F: FnOnce(&mut FakeTimerCtx<TimerId>) -> O,
fn with_fake_timer_ctx_mut<O, F>(&mut self, f: F) -> Owhere
F: FnOnce(&mut FakeTimerCtx<TimerId>) -> O,
Calls the callback with a mutable borrow of
FakeTimerCtx.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,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
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>>
fn send_frame<S>( &mut self, bindings_ctx: &mut BC, metadata: Meta, frame: S, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
Send a frame. Read more
Source§impl<BC, S, Meta, DeviceId> SendableFrameMeta<FakeCoreCtx<S, Meta, DeviceId>, BC> for Meta
impl<BC, S, Meta, DeviceId> SendableFrameMeta<FakeCoreCtx<S, Meta, DeviceId>, BC> for Meta
Source§fn send_meta<SS>(
self,
core_ctx: &mut FakeCoreCtx<S, Meta, DeviceId>,
bindings_ctx: &mut BC,
frame: SS,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, SS>>
fn send_meta<SS>( self, core_ctx: &mut FakeCoreCtx<S, Meta, DeviceId>, bindings_ctx: &mut BC, frame: SS, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, SS>>
Sends this frame metadata to the provided contexts.
Source§impl<Meta, BC> SendableFrameMeta<FakeFrameCtx<Meta>, BC> for Meta
impl<Meta, BC> SendableFrameMeta<FakeFrameCtx<Meta>, BC> for Meta
Source§fn send_meta<S>(
self,
core_ctx: &mut FakeFrameCtx<Meta>,
_bindings_ctx: &mut BC,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
fn send_meta<S>( self, core_ctx: &mut FakeFrameCtx<Meta>, _bindings_ctx: &mut BC, frame: S, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
Sends this frame metadata to the provided contexts.
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.