pub struct CompiledSimInstance<'a> { /* private fields */ }
sim
and stageleft_runtime
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 fn connect_sink_bincode<T: Serialize + 'static, M, O: Ordering, R: Retries>(
&mut self,
port: &ExternalBincodeSink<T, M, O, R>,
) -> SimSender<T, O, R>
👎Deprecated: Use connect
instead
pub fn connect_sink_bincode<T: Serialize + 'static, M, O: Ordering, R: Retries>( &mut self, port: &ExternalBincodeSink<T, M, O, R>, ) -> SimSender<T, O, R>
connect
insteadLike the corresponding method on crate::compile::deploy::DeployResult
, connects to the
given input port, and returns a closure that can be used to send messages to it.
Sourcepub fn connect_source_bincode<T: DeserializeOwned + 'static, O: Ordering, R: Retries>(
&mut self,
port: &ExternalBincodeStream<T, O, R>,
) -> SimReceiver<'a, T, O, R>
👎Deprecated: Use connect
instead
pub fn connect_source_bincode<T: DeserializeOwned + 'static, O: Ordering, R: Retries>( &mut self, port: &ExternalBincodeStream<T, O, R>, ) -> SimReceiver<'a, T, O, R>
connect
insteadLike the corresponding method on crate::compile::deploy::DeployResult
, connects to the
given output port, and returns a stream that can be used to receive messages from it.
Sourcepub fn connect<'b, P: ConnectableAsync<&'b mut Self>>(
&'b mut self,
port: P,
) -> <P as ConnectableAsync<&'b mut Self>>::Output
pub fn connect<'b, P: ConnectableAsync<&'b mut Self>>( &'b mut self, port: P, ) -> <P as ConnectableAsync<&'b mut Self>>::Output
Establishes a connection to the given input or output port, returning either a
SimSender
(for input ports) or a stream (for output ports). This should be invoked
before calling Self::launch
, and should only be invoked once per port.
Sourcepub fn launch(self)
pub fn launch(self)
Launches the simulation, which will asynchronously simulate the Hydro program. This should be invoked after connecting all inputs and outputs, but before receiving any messages.
Sourcepub fn schedule_with_logger<W: Write>(
self,
log_writer: W,
) -> impl use<W> + Future<Output = ()>
pub fn schedule_with_logger<W: Write>( self, log_writer: W, ) -> impl use<W> + Future<Output = ()>
Returns a future that schedules simulation with the given logger for reporting the simulation trace.
See Self::launch
for more details.
Trait Implementations§
Source§impl<'a, T: Serialize + 'static, M, O: Ordering, R: Retries> ConnectableAsync<&mut CompiledSimInstance<'a>> for &ExternalBincodeSink<T, M, O, R>
impl<'a, T: Serialize + 'static, M, O: Ordering, R: Retries> ConnectableAsync<&mut CompiledSimInstance<'a>> for &ExternalBincodeSink<T, M, O, R>
Source§impl<'a, T: DeserializeOwned + 'static, O: Ordering, R: Retries> ConnectableAsync<&mut CompiledSimInstance<'a>> for &ExternalBincodeStream<T, O, R>
impl<'a, T: DeserializeOwned + 'static, O: Ordering, R: Retries> ConnectableAsync<&mut CompiledSimInstance<'a>> for &ExternalBincodeStream<T, O, R>
Source§type Output = SimReceiver<'a, T, O, R>
type Output = SimReceiver<'a, T, O, R>
build
only.Source§async fn connect(self, ctx: &mut CompiledSimInstance<'a>) -> Self::Output
async fn connect(self, ctx: &mut CompiledSimInstance<'a>) -> Self::Output
build
only.Auto Trait Implementations§
impl<'a> Freeze for CompiledSimInstance<'a>
impl<'a> RefUnwindSafe for CompiledSimInstance<'a>
impl<'a> Send for CompiledSimInstance<'a>
impl<'a> Sync for CompiledSimInstance<'a>
impl<'a> Unpin for CompiledSimInstance<'a>
impl<'a> UnwindSafe for CompiledSimInstance<'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