pub struct FakeCoreCtx<S, Meta, DeviceId> {
pub state: S,
pub frames: FakeFrameCtx<Meta>,
/* private fields */
}
Expand description
A test helper used to provide an implementation of a core context.
Fields§
§state: S
Generic state kept in this fake context.
frames: FakeFrameCtx<Meta>
A fake frame context for outgoing frames.
Implementations§
Source§impl<S, Meta, DeviceId> FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> FakeCoreCtx<S, Meta, DeviceId>
Sourcepub fn with_state(state: S) -> Self
pub fn with_state(state: S) -> Self
Constructs a FakeCoreCtx
with the given state and default
FakeTimerCtx
, and FakeFrameCtx
.
Sourcepub fn take_frames(&mut self) -> Vec<(Meta, Vec<u8>)>
pub fn take_frames(&mut self) -> Vec<(Meta, Vec<u8>)>
Take the list of frames sent so far.
Sourcepub fn into_state(self) -> S
pub fn into_state(self) -> S
Consumes the FakeCoreCtx
and returns the inner state.
Trait Implementations§
Source§impl<S, Meta, DeviceId> AsRef<S> for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> AsRef<S> for FakeCoreCtx<S, Meta, DeviceId>
Source§impl<S, Meta, DeviceId> ContextProvider for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> ContextProvider for FakeCoreCtx<S, Meta, DeviceId>
Source§impl<T, S, Meta, DeviceId, BT> CoreTxMetadataContext<T, BT> for FakeCoreCtx<S, Meta, DeviceId>where
BT: TxMetadataBindingsTypes<TxMetadata = FakeTxMetadata>,
impl<T, S, Meta, DeviceId, BT> CoreTxMetadataContext<T, BT> for FakeCoreCtx<S, Meta, DeviceId>where
BT: TxMetadataBindingsTypes<TxMetadata = FakeTxMetadata>,
Source§fn convert_tx_meta(&self, _tx_meta: T) -> FakeTxMetadata
fn convert_tx_meta(&self, _tx_meta: T) -> FakeTxMetadata
Converts the tx metadata
T
into the type set by bindings. Read moreSource§impl<C, S, Meta, DeviceId> CounterContext<C> for FakeCoreCtx<S, Meta, DeviceId>where
S: CounterContext<C>,
impl<C, S, Meta, DeviceId> CounterContext<C> for FakeCoreCtx<S, Meta, DeviceId>where
S: CounterContext<C>,
Source§impl<S, Meta, DeviceId> Default for FakeCoreCtx<S, Meta, DeviceId>where
S: Default,
impl<S, Meta, DeviceId> Default for FakeCoreCtx<S, Meta, DeviceId>where
S: Default,
Source§impl<S, Meta, D: StrongDeviceIdentifier> DeviceIdContext<AnyDevice> for &mut FakeCoreCtx<S, Meta, D>
impl<S, Meta, D: StrongDeviceIdentifier> DeviceIdContext<AnyDevice> for &mut FakeCoreCtx<S, Meta, D>
Source§type WeakDeviceId = <D as StrongDeviceIdentifier>::Weak
type WeakDeviceId = <D as StrongDeviceIdentifier>::Weak
The type of weakly referenced device IDs.
Source§impl<S, Meta, D: StrongDeviceIdentifier> DeviceIdContext<AnyDevice> for FakeCoreCtx<S, Meta, D>
impl<S, Meta, D: StrongDeviceIdentifier> DeviceIdContext<AnyDevice> for FakeCoreCtx<S, Meta, D>
Source§type WeakDeviceId = <D as StrongDeviceIdentifier>::Weak
type WeakDeviceId = <D as StrongDeviceIdentifier>::Weak
The type of weakly referenced device IDs.
Source§impl<S, M> DeviceIdContext<FakeLinkDevice> for FakeCoreCtx<S, M, FakeLinkDeviceId>
impl<S, M> DeviceIdContext<FakeLinkDevice> for FakeCoreCtx<S, M, FakeLinkDeviceId>
Source§type DeviceId = FakeLinkDeviceId
type DeviceId = FakeLinkDeviceId
The type of device IDs.
Source§type WeakDeviceId = FakeWeakDeviceId<FakeLinkDeviceId>
type WeakDeviceId = FakeWeakDeviceId<FakeLinkDeviceId>
The type of weakly referenced device IDs.
Source§impl<I: AssignedAddrIpExt, S, Meta, DeviceId: StrongDeviceIdentifier> IpDeviceAddressIdContext<I> for FakeCoreCtx<S, Meta, DeviceId>
impl<I: AssignedAddrIpExt, S, Meta, DeviceId: StrongDeviceIdentifier> IpDeviceAddressIdContext<I> for FakeCoreCtx<S, Meta, DeviceId>
Source§type AddressId = AddrSubnet<<I as Ip>::Addr, <I as AssignedAddrIpExt>::AssignedWitness>
type AddressId = AddrSubnet<<I as Ip>::Addr, <I as AssignedAddrIpExt>::AssignedWitness>
The strong address identifier.
Source§type WeakAddressId = FakeWeakAddressId<<FakeCoreCtx<S, Meta, DeviceId> as IpDeviceAddressIdContext<I>>::AddressId>
type WeakAddressId = FakeWeakAddressId<<FakeCoreCtx<S, Meta, DeviceId> as IpDeviceAddressIdContext<I>>::AddressId>
The weak address identifier.
Source§impl<C, S, R, Meta, DeviceId> ResourceCounterContext<R, C> for FakeCoreCtx<S, Meta, DeviceId>where
S: ResourceCounterContext<R, C>,
impl<C, S, R, Meta, DeviceId> ResourceCounterContext<R, C> for FakeCoreCtx<S, Meta, DeviceId>where
S: ResourceCounterContext<R, C>,
Source§impl<S, Meta, DeviceId> WithFakeFrameContext<Meta> for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> WithFakeFrameContext<Meta> for FakeCoreCtx<S, Meta, DeviceId>
Source§fn with_fake_frame_ctx_mut<O, F: FnOnce(&mut FakeFrameCtx<Meta>) -> O>(
&mut self,
f: F,
) -> O
fn with_fake_frame_ctx_mut<O, F: FnOnce(&mut FakeFrameCtx<Meta>) -> O>( &mut self, f: F, ) -> O
Calls the callback with a mutable reference to the
FakeFrameCtx
.Auto Trait Implementations§
impl<S, Meta, DeviceId> Freeze for FakeCoreCtx<S, Meta, DeviceId>where
S: Freeze,
impl<S, Meta, DeviceId> !RefUnwindSafe for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> Send for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> !Sync for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> Unpin for FakeCoreCtx<S, Meta, DeviceId>
impl<S, Meta, DeviceId> !UnwindSafe for FakeCoreCtx<S, Meta, DeviceId>
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,
§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
§impl<L, T> UnlockedAccess<L> for Twhere
L: UnlockedAccessMarkerFor<T>,
impl<L, T> UnlockedAccess<L> for Twhere
L: UnlockedAccessMarkerFor<T>,
Source§impl<N> UnreachableExt for Nwhere
N: AsRef<Infallible>,
impl<N> UnreachableExt for Nwhere
N: AsRef<Infallible>,
Source§fn uninstantiable_unreachable<T>(&self) -> T
fn uninstantiable_unreachable<T>(&self) -> T
A method that can’t be called. Read more