CtxPairExt

Trait CtxPairExt 

Source
pub trait CtxPairExt<BC: BindingsContext> {
    // Required methods
    fn contexts(&mut self) -> (UnlockedCoreCtx<'_, BC>, &mut BC);
    fn core_ctx(&self) -> UnlockedCoreCtx<'_, BC>;

    // Provided methods
    fn core_api(&mut self) -> CoreApi<'_, &mut BC> { ... }
    fn test_api(&mut self) -> TestApi<'_, BC> { ... }
    fn trigger_next_timer<Id>(&mut self) -> Option<Id>
       where BC: FakeTimerCtxExt<Id>,
             for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id> { ... }
    fn trigger_timers_for<Id>(&mut self, duration: Duration) -> Vec<Id>
       where BC: FakeTimerCtxExt<Id>,
             for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id> { ... }
    fn trigger_timers_until_instant<Id>(
        &mut self,
        instant: FakeInstant,
    ) -> Vec<Id>
       where 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> { ... }
}
Expand description

Extensions to CtxPair when it holds a full stack state.

Required Methods§

Source

fn contexts(&mut self) -> (UnlockedCoreCtx<'_, BC>, &mut BC)

Retrieves the core and bindings context, respectively.

This function can be used to call into non-api core functions that want a core context.

Source

fn core_ctx(&self) -> UnlockedCoreCtx<'_, BC>

Like CtxPairExt::contexts, but retrieves only the core context.

Provided Methods§

Source

fn core_api(&mut self) -> CoreApi<'_, &mut BC>

Retrieves a CoreApi from this context pair.

Source

fn test_api(&mut self) -> TestApi<'_, BC>

Retrieves a TestApi from this context pair.

Source

fn trigger_next_timer<Id>(&mut self) -> Option<Id>
where BC: FakeTimerCtxExt<Id>, for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id>,

Source

fn trigger_timers_for<Id>(&mut self, duration: Duration) -> Vec<Id>
where BC: FakeTimerCtxExt<Id>, for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, Id>,

Source

fn trigger_timers_until_instant<Id>(&mut self, instant: FakeInstant) -> Vec<Id>
where BC: FakeTimerCtxExt<Id>, for<'a> UnlockedCoreCtx<'a, BC>: TimerHandler<BC, 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>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<CC, BC> CtxPairExt<BC> for CtxPair<CC, BC>
where CC: Borrow<StackState<BC>>, BC: BindingsContext,