pub struct VariableBuilder<T>where
T: FmiVariableBuilder,{ /* 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>where
T: FmiVariableBuilder,
impl<T> VariableBuilder<T>where
T: FmiVariableBuilder,
Sourcepub fn new(name: impl Into<String>, value_reference: fmi3ValueReference) -> Self
pub fn new(name: impl Into<String>, value_reference: fmi3ValueReference) -> Self
Create a new variable builder with the given name.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description for the variable.
Sourcepub fn with_causality(self, causality: Causality) -> Self
pub fn with_causality(self, causality: Causality) -> Self
Set the causality for the variable.
Sourcepub fn with_variability(self, variability: Variability) -> Self
pub fn with_variability(self, variability: Variability) -> Self
Set the variability for the variable.
Sourcepub fn with_can_handle_multiple_set_per_time_instant(self, value: bool) -> Self
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.
Sourcepub fn with_intermediate_update(self, value: bool) -> Self
pub fn with_intermediate_update(self, value: bool) -> Self
Set whether the variable can be updated during intermediate update mode.
Sourcepub fn with_previous(self, value_reference: u32) -> Self
pub fn with_previous(self, value_reference: u32) -> Self
Set the value reference of the variable that provides the previous value.
Sourcepub fn with_declared_type(self, type_name: impl Into<String>) -> Self
pub fn with_declared_type(self, type_name: impl Into<String>) -> Self
Set the declared type name from TypeDefinitions.
Sourcepub fn with_initial(self, initial: Initial) -> Self
pub fn with_initial(self, initial: Initial) -> Self
Set the initial attribute for the variable.
Sourcepub fn with_start(self, start: impl Into<T::Start>) -> Self
pub fn with_start(self, start: impl Into<T::Start>) -> Self
Set the start value for the variable.
Sourcepub fn with_derivative(self, derivative_vr: u32) -> Self
pub fn with_derivative(self, derivative_vr: u32) -> Self
Set the derivative relationship for the variable (value reference of state variable).
Sourcepub fn with_reinit(self, reinit: bool) -> Self
pub fn with_reinit(self, reinit: bool) -> Self
Set whether the variable can be reinitialized during event mode.
Sourcepub fn with_nominal(self, nominal: f64) -> Self
pub fn with_nominal(self, nominal: f64) -> Self
Set the nominal value for the variable (float types).
Sourcepub fn with_quantity(self, quantity: impl Into<String>) -> Self
pub fn with_quantity(self, quantity: impl Into<String>) -> Self
Set the quantity for the variable (integer types).
Sourcepub fn with_dimensions(self, dimensions: Vec<Dimension>) -> Self
pub fn with_dimensions(self, dimensions: Vec<Dimension>) -> Self
Add dimensions to the variable (for array types).
Sourcepub fn with_max_size(self, max_size: usize) -> Self
pub fn with_max_size(self, max_size: usize) -> Self
Set the maximum size for binary variables.
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Set the MIME type for binary variables.
Sourcepub fn with_clocks(self, clocks: Vec<u32>) -> Self
pub fn with_clocks(self, clocks: Vec<u32>) -> Self
Set the clocks that this variable belongs to.
Auto Trait Implementations§
impl<T> Freeze for VariableBuilder<T>
impl<T> RefUnwindSafe for VariableBuilder<T>
impl<T> Send for VariableBuilder<T>
impl<T> Sync for VariableBuilder<T>
impl<T> Unpin for VariableBuilder<T>
impl<T> UnwindSafe for VariableBuilder<T>
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
Source§impl<T> InitializeFromStart<T> for T
impl<T> InitializeFromStart<T> for T
fn set_from_start(&mut self, value: T)
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