Struct 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 std::convert::Infallible;
use rtlola_interpreter::monitor::Incremental;
use rtlola_interpreter::input::ArrayFactory;
use rtlola_interpreter::time::RelativeFloat;
use rtlola_interpreter::{ConfigBuilder, Monitor, Value};

let monitor: Monitor<_, _, Incremental, _> = ConfigBuilder::new()
    .spec_str("input i: Int64")
    .offline::<RelativeFloat>()
    .with_array_events::<1, Infallible, [Value; 1]>()
    .with_verdict::<Incremental>()
    .monitor().expect("Failed to create monitor.");

Implementations§

Source§

impl ConfigBuilder<ConfigureIR, RelativeFloat>

Source

pub fn new() -> Self

Creates a new configuration to be used with the API.

Source§

impl<S: ConfigState, OutputTime: OutputTimeRepresentation> ConfigBuilder<S, OutputTime>

Source

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.

Source

pub fn start_time(self, time: SystemTime) -> Self

Sets the start time of the execution.

Source§

impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<ConfigureIR, OutputTime>

Source

pub fn with_ir(self, ir: RtLolaMir) -> ConfigBuilder<IrConfigured, OutputTime>

Use an existing ir with the configuration

Source

pub fn spec_file(self, path: PathBuf) -> ConfigBuilder<IrConfigured, OutputTime>

Read the specification from a file at the given path.

Source

pub fn spec_str(self, spec: &str) -> ConfigBuilder<IrConfigured, OutputTime>

Read the specification from the given string.

Source§

impl<OutputTime: OutputTimeRepresentation> ConfigBuilder<IrConfigured, OutputTime>

Source

pub fn online(self) -> ConfigBuilder<ModeConfigured<OnlineMode>, OutputTime>

Sets the execute mode to be online, i.e. the time of events is taken by the interpreter.

Source

pub fn offline<InputTime: TimeRepresentation>( self, ) -> ConfigBuilder<ModeConfigured<OfflineMode<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<Mode: ExecutionMode, OutputTime: OutputTimeRepresentation> ConfigBuilder<ModeConfigured<Mode>, OutputTime>

Source

pub fn with_array_events<const N: usize, I: Error + Send + 'static, E: TryInto<[Value; N], Error = I> + CondSerialize + CondDeserialize + Send>( self, ) -> ConfigBuilder<InputConfigured<Mode, ArrayFactory<N, I, E>>, OutputTime>

Use the predefined ArrayFactory method to provide inputs to the API.

Source

pub fn with_mapped_events<Inner: InputMap>( self, ) -> ConfigBuilder<InputConfigured<Mode, MappedFactory<Inner>>, OutputTime>

Use the predefined MappedFactory method to provide inputs to the API. Requires implementing InputMap for your type defining how the values of input streams are extracted from it.

Source

pub fn with_event_factory<Source: EventFactory>( self, ) -> ConfigBuilder<InputConfigured<Mode, Source>, OutputTime>

Use a custom input method to provide inputs to the API.

Source§

impl<Mode: ExecutionMode, OutputTime: OutputTimeRepresentation, Source: EventFactory> ConfigBuilder<InputConfigured<Mode, Source>, OutputTime>

Source

pub fn with_verdict<Verdict: VerdictRepresentation>( self, ) -> ConfigBuilder<VerdictConfigured<Mode, Source, Verdict>, OutputTime>

Sets the VerdictRepresentation for the monitor

Source§

impl<Source: EventFactory + 'static, Mode: ExecutionMode, Verdict: VerdictRepresentation<Tracing = NoTracer>, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<Mode, Source, Verdict>, OutputTime>

Source

pub fn with_tracer<T: Tracer>( self, ) -> ConfigBuilder<VerdictConfigured<Mode, Source, TracingVerdict<T, Verdict>>, OutputTime>

Adds tracing functionality to the evaluator

Source§

impl<Source: EventFactory + 'static, Mode: ExecutionMode, Verdict: VerdictRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<Mode, Source, Verdict>, OutputTime>

Source

pub fn build(self) -> MonitorConfig<Source, Mode, Verdict, OutputTime>

Finalize the configuration and generate a configuration.

Source

pub fn monitor_with_data( self, data: Source::CreationData, ) -> Result<Monitor<Source, Mode, Verdict, OutputTime>, EventFactoryError>

Create a Monitor from the configuration. The entrypoint of the API. The data is provided to the Input source at creation.

Source

pub fn monitor( self, ) -> Result<Monitor<Source, Mode, Verdict, OutputTime>, EventFactoryError>
where Source: EventFactory<CreationData = ()> + 'static,

Create a Monitor from the configuration. The entrypoint of the API.

Source§

impl<Source: EventFactory + 'static, SourceTime: TimeRepresentation, Verdict: VerdictRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<OfflineMode<SourceTime>, Source, Verdict>, OutputTime>

Source

pub fn queued_monitor_with_data( self, data: Source::CreationData, ) -> QueuedMonitor<Source, OfflineMode<SourceTime>, Verdict, OutputTime>

Create a QueuedMonitor from the configuration. The entrypoint of the API. The data is provided to the Input source at creation.

Source

pub fn queued_monitor( self, ) -> QueuedMonitor<Source, OfflineMode<SourceTime>, Verdict, OutputTime>
where Source: EventFactory<CreationData = ()> + 'static,

Create a QueuedMonitor from the configuration. The entrypoint of the API.

Source§

impl<Source: EventFactory + 'static, Verdict: VerdictRepresentation, OutputTime: OutputTimeRepresentation> ConfigBuilder<VerdictConfigured<OnlineMode, Source, Verdict>, OutputTime>

Source

pub fn queued_monitor_with_data( self, data: Source::CreationData, ) -> QueuedMonitor<Source, OnlineMode, Verdict, OutputTime>

Create a QueuedMonitor from the configuration. The entrypoint of the API. The data is provided to the Input source at creation.

Source

pub fn queued_monitor( self, ) -> QueuedMonitor<Source, OnlineMode, Verdict, OutputTime>
where Source: EventFactory<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>

Source§

fn clone(&self) -> ConfigBuilder<S, OutputTime>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug + ConfigState, OutputTime: Debug + OutputTimeRepresentation> Debug for ConfigBuilder<S, OutputTime>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConfigBuilder<ConfigureIR, RelativeFloat>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, OutputTime> Freeze for ConfigBuilder<S, OutputTime>
where S: Freeze,

§

impl<S, OutputTime> RefUnwindSafe for ConfigBuilder<S, OutputTime>
where S: RefUnwindSafe, OutputTime: RefUnwindSafe,

§

impl<S, OutputTime> Send for ConfigBuilder<S, OutputTime>
where S: Send,

§

impl<S, OutputTime> Sync for ConfigBuilder<S, OutputTime>
where S: Sync, OutputTime: Sync,

§

impl<S, OutputTime> Unpin for ConfigBuilder<S, OutputTime>
where S: Unpin, OutputTime: Unpin,

§

impl<S, OutputTime> UnwindSafe for ConfigBuilder<S, OutputTime>
where S: UnwindSafe, OutputTime: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> CondDeserialize for T

Source§

impl<T> CondSerialize for T