pub struct TestNoStdRuntime<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize>{ /* private fields */ }Expand description
A tiny, no_std test runtime:
- round-robin over nodes
- uses a single occupancy array
- no heap, no threads, no timers
Implementations§
Source§impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct with a pessimistic initial occupancy; init() will overwrite it.
Sourcepub fn with_telemetry<F, R>(&mut self, f: F) -> Result<Option<R>, RuntimeError>
pub fn with_telemetry<F, R>(&mut self, f: F) -> Result<Option<R>, RuntimeError>
Safely access telemetry by mutable reference, if it is present.
Returns:
Ok(Some(r))if telemetry is present andfran.Ok(None)if telemetry is currently absent (e.g. not yet initialized).
This never panics and never moves telemetry out of the runtime.
Trait Implementations§
Source§impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Default for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Default for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
Source§impl<Graph, C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> LimenRuntime<Graph, NODE_COUNT, EDGE_COUNT> for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<Graph, C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> LimenRuntime<Graph, NODE_COUNT, EDGE_COUNT> for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
Source§type Error = RuntimeError
type Error = RuntimeError
Error type produced by the runtime. Use
core::convert::Infallible if none.Source§type StopHandle = RuntimeStopHandle
type StopHandle = RuntimeStopHandle
External stop handle type.
Clone + Send + Sync + 'static.
Only available under std.Source§fn init(
&mut self,
graph: &mut Graph,
clock: Self::Clock,
telemetry: Self::Telemetry,
) -> Result<(), Self::Error>
fn init( &mut self, graph: &mut Graph, clock: Self::Clock, telemetry: Self::Telemetry, ) -> Result<(), Self::Error>
Initialize internal state and adopt the provided clock & telemetry.
Source§fn reset(&mut self, graph: &Graph) -> Result<(), Self::Error>
fn reset(&mut self, graph: &Graph) -> Result<(), Self::Error>
Reset internal runtime state (keep graph/node state unless your policy requires otherwise).
Source§fn request_stop(&mut self)
fn request_stop(&mut self)
Request a cooperative stop.
Source§fn is_stopping(&self) -> bool
fn is_stopping(&self) -> bool
Return
true iff a stop has been requested.Source§fn occupancies(&self) -> &[EdgeOccupancy; EDGE_COUNT]
fn occupancies(&self) -> &[EdgeOccupancy; EDGE_COUNT]
Borrow the runtime’s persistent edge-occupancy buffer.
Source§fn step(&mut self, graph: &mut Graph) -> Result<bool, Self::Error>
fn step(&mut self, graph: &mut Graph) -> Result<bool, Self::Error>
Execute one scheduler tick. Return
Ok(true) if more work remains, Ok(false) to stop.Source§fn stop_handle(&self) -> Option<Self::StopHandle>
fn stop_handle(&self) -> Option<Self::StopHandle>
Return an external stop handle, if the runtime supports it.
Clone before calling
run() to enable stopping from another thread.Auto Trait Implementations§
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Freeze for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> RefUnwindSafe for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Send for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Sync for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Unpin for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> UnsafeUnpin for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>where
C: UnsafeUnpin,
T: UnsafeUnpin,
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> UnwindSafe for TestNoStdRuntime<C, T, NODE_COUNT, EDGE_COUNT>where
C: UnwindSafe,
T: 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