pub struct CompiledSimInstance<'a> { /* private fields */ }Available on
stageleft_runtime and crate feature sim only.Expand description
A single instance of a compiled Hydro simulation, which provides methods to interactively execute the simulation, feed inputs, and receive outputs.
Implementations§
Source§impl<'a> CompiledSimInstance<'a>
impl<'a> CompiledSimInstance<'a>
Sourcepub async fn run_with_scheduler_and_logger<W: Write>(
self,
log_writer: W,
thunk: impl Future<Output = ()>,
)
pub async fn run_with_scheduler_and_logger<W: Write>( self, log_writer: W, thunk: impl Future<Output = ()>, )
Runs the simulation scheduler alongside the given future, until the future completes, reporting the simulation trace to the given logger.
The future always gets to run first; whenever it is blocked (e.g. waiting to receive simulation outputs), the scheduler runs a single step to completion. Steps are atomic with respect to the future: it is re-polled between every pair of scheduler steps, but never while a step is in flight.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CompiledSimInstance<'a>
impl<'a> !Send for CompiledSimInstance<'a>
impl<'a> !Sync for CompiledSimInstance<'a>
impl<'a> !UnwindSafe for CompiledSimInstance<'a>
impl<'a> Forget for CompiledSimInstance<'a>
impl<'a> Freeze for CompiledSimInstance<'a>where
*mut c_void: Freeze,
PhantomData<unsafe fn(bool, &mut HashMap<usize, Receiver<Bytes>>, &mut HashMap<usize, Sender<Bytes>>, &mut HashMap<usize, HashMap<u32, Receiver<Bytes>>>, &mut HashMap<usize, HashMap<u32, Sender<Bytes>>>, fn(Arguments<'_>), fn(Arguments<'_>), fn(&str) -> !, RetryBudget) -> (Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, HashMap<SimLocation, Vec<Box<dyn TickInputHook>>>, HashMap<SimLocation, Vec<Box<dyn ObservationHook>>>, HashMap<SimLocation, Vec<Box<dyn InlineHook>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>>, BTreeMap<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>>)>: Freeze,
PhantomData<&'a unsafe fn(bool, &mut HashMap<usize, Receiver<Bytes>>, &mut HashMap<usize, Sender<Bytes>>, &mut HashMap<usize, HashMap<u32, Receiver<Bytes>>>, &mut HashMap<usize, HashMap<u32, Sender<Bytes>>>, fn(Arguments<'_>), fn(Arguments<'_>), fn(&str) -> !, RetryBudget) -> (Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, HashMap<SimLocation, Vec<Box<dyn TickInputHook>>>, HashMap<SimLocation, Vec<Box<dyn ObservationHook>>>, HashMap<SimLocation, Vec<Box<dyn InlineHook>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>>, BTreeMap<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>>)>: Freeze,
PhantomData<SimExternalPort>: Freeze,
*const u8 is !null: Freeze,
PhantomData<(ExternalPortId, SimExternalPort)>: Freeze,
PhantomData<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>: Freeze,
PhantomData<(SimLocation, Vec<Box<dyn TickInputHook>>)>: Freeze,
PhantomData<(SimLocation, Vec<Box<dyn ObservationHook>>)>: Freeze,
PhantomData<(SimLocation, Vec<Box<dyn InlineHook>>)>: Freeze,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>)>: Freeze,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>)>: Freeze,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>)>: Freeze,
*const LeafNode<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<((usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>)>>: Freeze,
impl<'a> Move for CompiledSimInstance<'a>
impl<'a> Unpin for CompiledSimInstance<'a>where
*mut c_void: Unpin,
&'a unsafe fn(bool, &mut HashMap<usize, Receiver<Bytes>>, &mut HashMap<usize, Sender<Bytes>>, &mut HashMap<usize, HashMap<u32, Receiver<Bytes>>>, &mut HashMap<usize, HashMap<u32, Sender<Bytes>>>, fn(Arguments<'_>), fn(Arguments<'_>), fn(&str) -> !, RetryBudget) -> (Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, HashMap<SimLocation, Vec<Box<dyn TickInputHook>>>, HashMap<SimLocation, Vec<Box<dyn ObservationHook>>>, HashMap<SimLocation, Vec<Box<dyn InlineHook>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>>, BTreeMap<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>>): Unpin,
*const u8 is !null: Unpin,
NonZero<u32>: Unpin,
Box<LocationId>: Unpin,
Box<dyn TickClosureErasedAsyncInner<()>>: Unpin,
Arc<WakeState>: Unpin,
(): Unpin,
Box<dyn Future<Output = ()> + Send>: Unpin,
Box<dyn TickInputHook>: Unpin,
Box<dyn ObservationHook>: Unpin,
Box<dyn InlineHook>: Unpin,
Rc<RefCell<dyn ScriptedTickInputHook>>: Unpin,
Rc<RefCell<dyn ScriptedObservationHook>>: Unpin,
Rc<RefCell<dyn ScriptedInlineHook>>: Unpin,
*const LeafNode<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>> is !null: Unpin,
Box<((usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>)>: Unpin,
impl<'a> UnsafeUnpin for CompiledSimInstance<'a>where
*mut c_void: UnsafeUnpin,
PhantomData<unsafe fn(bool, &mut HashMap<usize, Receiver<Bytes>>, &mut HashMap<usize, Sender<Bytes>>, &mut HashMap<usize, HashMap<u32, Receiver<Bytes>>>, &mut HashMap<usize, HashMap<u32, Sender<Bytes>>>, fn(Arguments<'_>), fn(Arguments<'_>), fn(&str) -> !, RetryBudget) -> (Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, HashMap<SimLocation, Vec<Box<dyn TickInputHook>>>, HashMap<SimLocation, Vec<Box<dyn ObservationHook>>>, HashMap<SimLocation, Vec<Box<dyn InlineHook>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>>, BTreeMap<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>>)>: UnsafeUnpin,
PhantomData<&'a unsafe fn(bool, &mut HashMap<usize, Receiver<Bytes>>, &mut HashMap<usize, Sender<Bytes>>, &mut HashMap<usize, HashMap<u32, Receiver<Bytes>>>, &mut HashMap<usize, HashMap<u32, Sender<Bytes>>>, fn(Arguments<'_>), fn(Arguments<'_>), fn(&str) -> !, RetryBudget) -> (Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, Vec<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>, HashMap<SimLocation, Vec<Box<dyn TickInputHook>>>, HashMap<SimLocation, Vec<Box<dyn ObservationHook>>>, HashMap<SimLocation, Vec<Box<dyn InlineHook>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>>, HashMap<SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>>, BTreeMap<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>>)>: UnsafeUnpin,
PhantomData<SimExternalPort>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(ExternalPortId, SimExternalPort)>: UnsafeUnpin,
PhantomData<(LocationId, Option<u32>, Dfir<TickClosureErasedAsync<()>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Box<dyn TickInputHook>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Box<dyn ObservationHook>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Box<dyn InlineHook>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedTickInputHook>>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedObservationHook>>>)>: UnsafeUnpin,
PhantomData<(SimLocation, Vec<Rc<RefCell<dyn ScriptedInlineHook>>>)>: UnsafeUnpin,
*const LeafNode<(usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<((usize, Option<u32>), Rc<RefCell<dyn ScriptedHookControl>>)>>: UnsafeUnpin,
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
§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> ⓘ
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 moreCreates a shared type from an unshared type.