Skip to main content

VariableBuilder

Struct VariableBuilder 

Source
pub struct VariableBuilder<T>{ /* private fields */ }
Expand description

A builder for creating FMI variables with a fluent interface.

This builder holds all possible FMI variable attributes. The generic type T determines which concrete FMI variable type will be created by finish(). Type-specific finish() implementations will extract only the relevant fields.

Implementations§

Source§

impl<T> VariableBuilder<T>

Source

pub fn new(name: impl Into<String>, value_reference: fmi3ValueReference) -> Self

Create a new variable builder with the given name.

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Set the description for the variable.

Source

pub fn with_causality(self, causality: Causality) -> Self

Set the causality for the variable.

Source

pub fn with_variability(self, variability: Variability) -> Self

Set the variability for the variable.

Source

pub fn with_can_handle_multiple_set_per_time_instant(self, value: bool) -> Self

Set whether the variable can handle multiple set operations per time instant.

Source

pub fn with_intermediate_update(self, value: bool) -> Self

Set whether the variable can be updated during intermediate update mode.

Source

pub fn with_previous(self, value_reference: u32) -> Self

Set the value reference of the variable that provides the previous value.

Source

pub fn with_declared_type(self, type_name: impl Into<String>) -> Self

Set the declared type name from TypeDefinitions.

Source

pub fn with_initial(self, initial: Initial) -> Self

Set the initial attribute for the variable.

Source

pub fn with_start(self, start: impl Into<T::Start>) -> Self

Set the start value for the variable.

Source

pub fn with_derivative(self, derivative_vr: u32) -> Self

Set the derivative relationship for the variable (value reference of state variable).

Source

pub fn with_reinit(self, reinit: bool) -> Self

Set whether the variable can be reinitialized during event mode.

Source

pub fn with_min(self, min: f64) -> Self

Set the minimum value for the variable (float types).

Source

pub fn with_max(self, max: f64) -> Self

Set the maximum value for the variable (float types).

Source

pub fn with_nominal(self, nominal: f64) -> Self

Set the nominal value for the variable (float types).

Source

pub fn with_quantity(self, quantity: impl Into<String>) -> Self

Set the quantity for the variable (integer types).

Source

pub fn with_dimensions(self, dimensions: Vec<Dimension>) -> Self

Add dimensions to the variable (for array types).

Source

pub fn with_max_size(self, max_size: usize) -> Self

Set the maximum size for binary variables.

Source

pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self

Set the MIME type for binary variables.

Source

pub fn with_clocks(self, clocks: Vec<u32>) -> Self

Set the clocks that this variable belongs to.

Source

pub fn finish(self) -> T::Var

Build the final FMI variable.

This delegates to the type-specific finish implementation which will extract only the relevant fields for the concrete variable type.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromStart<T> for T

Source§

fn set_from_start(&mut self, value: T)

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, 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.