pub struct SimFlow<'a> { /* private fields */ }
sim
and stageleft_runtime
only.Expand description
A not-yet-compiled simulator for a Hydro program.
Implementations§
Source§impl<'a> SimFlow<'a>
impl<'a> SimFlow<'a>
Sourcepub fn with_instance<T>(
self,
thunk: impl FnOnce(CompiledSimInstance<'_>) -> T,
) -> T
pub fn with_instance<T>( self, thunk: impl FnOnce(CompiledSimInstance<'_>) -> T, ) -> T
Executes the given closure with a single instance of the compiled simulation.
Sourcepub fn fuzz(self, thunk: impl AsyncFn(CompiledSimInstance<'_>) + RefUnwindSafe)
pub fn fuzz(self, thunk: impl AsyncFn(CompiledSimInstance<'_>) + RefUnwindSafe)
Uses a fuzzing strategy to explore possible executions of the simulation. The provided closure will be repeatedly executed with instances of the Hydro program where the batching boundaries, order of messages, and retries are varied.
During development, you should run the test that invokes this function with the cargo sim
command, which will use libfuzzer
to intelligently explore the execution space. If a
failure is found, a minimized test case will be produced in a sim-failures
directory.
When running the test with cargo test
(such as in CI), if a reproducer is found it will
be executed, and if no reproducer is found a small number of random executions will be
performed.
Sourcepub fn exhaustive(
self,
thunk: impl AsyncFn(CompiledSimInstance<'_>) + RefUnwindSafe,
) -> usize
pub fn exhaustive( self, thunk: impl AsyncFn(CompiledSimInstance<'_>) + RefUnwindSafe, ) -> usize
Exhaustively searches all possible executions of the simulation. The provided closure will be repeatedly executed with instances of the Hydro program where the batching boundaries, order of messages, and retries are varied.
Exhaustive searching is feasible when the inputs to the Hydro program are finite and there
are no dataflow loops that generate infinite messages. Exhaustive searching provides a
stronger guarantee of correctness than fuzzing, but may take a long time to complete.
Because no fuzzer is involved, you can run exhaustive tests with cargo test
.
Returns the number of distinct executions explored.
Sourcepub fn compiled(self) -> CompiledSim
pub fn compiled(self) -> CompiledSim
Compiles the simulation into a dynamically loadable library, and returns a handle to it.
Auto Trait Implementations§
impl<'a> Freeze for SimFlow<'a>
impl<'a> !RefUnwindSafe for SimFlow<'a>
impl<'a> !Send for SimFlow<'a>
impl<'a> !Sync for SimFlow<'a>
impl<'a> Unpin for SimFlow<'a>
impl<'a> !UnwindSafe for SimFlow<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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