Struct rtlola_interpreter::ConfigBuilder
source · pub struct ConfigBuilder<S: ConfigState, OutputTime: OutputTimeRepresentation> { /* private fields */ }
Expand description
The main entry point of the application. Use the various methods to construct a configuration either for running the interpreter directly or to use the Monitor API interface.
An example construction of the API:
use rtlola_interpreter::monitor::{EventInput, Incremental};
use rtlola_interpreter::time::RelativeFloat;
use rtlola_interpreter::{ConfigBuilder, Monitor, Value};
let monitor: Monitor<_, _, Incremental, _> = ConfigBuilder::new()
.spec_str("input i: Int64")
.offline::<RelativeFloat>()
.event_input::<Vec<Value>>()
.with_verdict::<Incremental>()
.monitor().expect("Failed to create monitor.");
Implementations§
source§impl ConfigBuilder<ConfigureIR, RelativeFloat>
impl ConfigBuilder<ConfigureIR, RelativeFloat>
source§impl<S: ConfigState, OutputTime: OutputTimeRepresentation> ConfigBuilder<S, OutputTime>
impl<S: ConfigState, OutputTime: OutputTimeRepresentation> ConfigBuilder<S, OutputTime>
sourcepub fn output_time<T: OutputTimeRepresentation>(self) -> ConfigBuilder<S, T>
pub fn output_time<T: OutputTimeRepresentation>(self) -> ConfigBuilder<S, T>
Sets the format in which time is returned. See the README for more details on time formats. For possible formats see the OutputTimeRepresentation trait.
sourcepub fn start_time(self, time: SystemTime) -> Self
pub fn start_time(self, time: SystemTime) -> Self
Sets the start time of the execution.
source§impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<ConfigureIR, OutputTime>
impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<ConfigureIR, OutputTime>
sourcepub fn with_ir(self, ir: RtLolaMir) -> ConfigBuilder<IrConfigured, OutputTime>
pub fn with_ir(self, ir: RtLolaMir) -> ConfigBuilder<IrConfigured, OutputTime>
Use an existing ir with the configuration
sourcepub fn spec_file(self, path: PathBuf) -> ConfigBuilder<IrConfigured, OutputTime>
pub fn spec_file(self, path: PathBuf) -> ConfigBuilder<IrConfigured, OutputTime>
Read the specification from a file at the given path.
sourcepub fn spec_str(self, spec: &str) -> ConfigBuilder<IrConfigured, OutputTime>
pub fn spec_str(self, spec: &str) -> ConfigBuilder<IrConfigured, OutputTime>
Read the specification from the given string.
source§impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<IrConfigured, OutputTime>
impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<IrConfigured, OutputTime>
sourcepub fn online(self) -> ConfigBuilder<ModeConfigured<RealTime>, OutputTime>
pub fn online(self) -> ConfigBuilder<ModeConfigured<RealTime>, OutputTime>
Sets the execute mode to be online, i.e. the time of events is taken by the interpreter.
sourcepub fn offline<InputTime: TimeRepresentation>(
self
) -> ConfigBuilder<ModeConfigured<InputTime>, OutputTime>
pub fn offline<InputTime: TimeRepresentation>(
self
) -> ConfigBuilder<ModeConfigured<InputTime>, OutputTime>
Sets the execute mode to be offline, i.e. takes the time of events from the input source. How the input timestamps are interpreted is defined by the type parameter. See the README for further details on timestamp representations. For possible TimeRepresentations see the Time Module.
source§impl<InputTime: TimeRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<ModeConfigured<InputTime>, OutputTime>
impl<InputTime: TimeRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<ModeConfigured<InputTime>, OutputTime>
sourcepub fn event_input<E: Into<Event> + CondSerialize + CondDeserialize + Send>(
self
) -> ConfigBuilder<InputConfigured<InputTime, EventInput<E>>, OutputTime>
pub fn event_input<E: Into<Event> + CondSerialize + CondDeserialize + Send>(
self
) -> ConfigBuilder<InputConfigured<InputTime, EventInput<E>>, OutputTime>
Use the predefined EventInput method to provide inputs to the API.
sourcepub fn record_input<Inner: Record>(
self
) -> ConfigBuilder<InputConfigured<InputTime, RecordInput<Inner>>, OutputTime>
pub fn record_input<Inner: Record>(
self
) -> ConfigBuilder<InputConfigured<InputTime, RecordInput<Inner>>, OutputTime>
Use the predefined RecordInput method to provide inputs to the API.
sourcepub fn custom_input<Source: Input>(
self
) -> ConfigBuilder<InputConfigured<InputTime, Source>, OutputTime>
pub fn custom_input<Source: Input>(
self
) -> ConfigBuilder<InputConfigured<InputTime, Source>, OutputTime>
Use a custom input method to provide inputs to the API.
source§impl<InputTime: TimeRepresentation, OutputTime: OutputTimeRepresentation, Source: Input> ConfigBuilder<InputConfigured<InputTime, Source>, OutputTime>
impl<InputTime: TimeRepresentation, OutputTime: OutputTimeRepresentation, Source: Input> ConfigBuilder<InputConfigured<InputTime, Source>, OutputTime>
sourcepub fn with_verdict<Verdict: VerdictRepresentation>(
self
) -> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
pub fn with_verdict<Verdict: VerdictRepresentation>(
self
) -> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
Sets the VerdictRepresentation for the monitor
source§impl<Source: Input + 'static, InputTime: TimeRepresentation, Verdict: VerdictRepresentation<Tracing = NoTracer>, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
impl<Source: Input + 'static, InputTime: TimeRepresentation, Verdict: VerdictRepresentation<Tracing = NoTracer>, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
sourcepub fn with_tracer<T: Tracer>(
self
) -> ConfigBuilder<VerdictConfigured<InputTime, Source, TracingVerdict<T, Verdict>>, OutputTime>
pub fn with_tracer<T: Tracer>(
self
) -> ConfigBuilder<VerdictConfigured<InputTime, Source, TracingVerdict<T, Verdict>>, OutputTime>
Adds tracing functionality to the evaluator
source§impl<Source: Input + 'static, InputTime: TimeRepresentation, Verdict: VerdictRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
impl<Source: Input + 'static, InputTime: TimeRepresentation, Verdict: VerdictRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<InputTime, Source, Verdict>, OutputTime>
sourcepub fn build(self) -> MonitorConfig<Source, InputTime, Verdict, OutputTime>
pub fn build(self) -> MonitorConfig<Source, InputTime, Verdict, OutputTime>
Finalize the configuration and generate a configuration.
Examples found in repository?
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
pub fn monitor_with_data(
self,
data: Source::CreationData,
) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error> {
self.build().monitor_with_data(data)
}
/// Create a [Monitor] from the configuration. The entrypoint of the API.
pub fn monitor(self) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error>
where
Source: Input<CreationData = ()> + 'static,
{
self.build().monitor()
}
#[cfg(feature = "queued-api")]
/// Create a [QueuedMonitor] from the configuration. The entrypoint of the API. The data is provided to the [Input](crate::monitor::Input) source at creation.
pub fn queued_monitor_with_data(
self,
data: Source::CreationData,
) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime> {
self.build().queued_monitor_with_data(data)
}
#[cfg(feature = "queued-api")]
/// Create a [QueuedMonitor] from the configuration. The entrypoint of the API.
pub fn queued_monitor(self) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime>
where
Source: Input<CreationData = ()> + 'static,
{
self.build().queued_monitor()
}
sourcepub fn monitor_with_data(
self,
data: Source::CreationData
) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error>
pub fn monitor_with_data(
self,
data: Source::CreationData
) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error>
sourcepub fn monitor(
self
) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error>where
Source: Input<CreationData = ()> + 'static,
pub fn monitor(
self
) -> Result<Monitor<Source, InputTime, Verdict, OutputTime>, Source::Error>where
Source: Input<CreationData = ()> + 'static,
Create a Monitor from the configuration. The entrypoint of the API.
sourcepub fn queued_monitor_with_data(
self,
data: Source::CreationData
) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime>
pub fn queued_monitor_with_data(
self,
data: Source::CreationData
) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime>
Create a QueuedMonitor from the configuration. The entrypoint of the API. The data is provided to the Input source at creation.
sourcepub fn queued_monitor(
self
) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime>where
Source: Input<CreationData = ()> + 'static,
pub fn queued_monitor(
self
) -> QueuedMonitor<Source, InputTime, Verdict, OutputTime>where
Source: Input<CreationData = ()> + 'static,
Create a QueuedMonitor from the configuration. The entrypoint of the API.
Trait Implementations§
source§impl<S: Clone + ConfigState, OutputTime: Clone + OutputTimeRepresentation> Clone for ConfigBuilder<S, OutputTime>
impl<S: Clone + ConfigState, OutputTime: Clone + OutputTimeRepresentation> Clone for ConfigBuilder<S, OutputTime>
source§fn clone(&self) -> ConfigBuilder<S, OutputTime>
fn clone(&self) -> ConfigBuilder<S, OutputTime>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more