Skip to main content

Context

Trait Context 

Source
pub trait Context<M: UserModel> {
    // Required methods
    fn logging_on(&self, category: M::LoggingCategory) -> bool;
    fn set_logging(&mut self, category: M::LoggingCategory, enabled: bool);
    fn log(
        &self,
        status: Fmi3Status,
        category: M::LoggingCategory,
        args: Arguments<'_>,
    );
    fn resource_path(&self) -> &PathBuf;
    fn initialize(&mut self, start_time: f64, stop_time: Option<f64>);
    fn time(&self) -> f64;
    fn set_time(&mut self, time: f64);
    fn stop_time(&self) -> Option<f64>;
    fn as_any_mut(&mut self) -> &mut dyn Any;

    // Provided method
    fn early_return_allowed(&self) -> bool { ... }
}
Expand description

Context trait for FMU instances

Required Methods§

Source

fn logging_on(&self, category: M::LoggingCategory) -> bool

Check if logging is enabled for the specified category.

Source

fn set_logging(&mut self, category: M::LoggingCategory, enabled: bool)

Enable or disable logging for the specified category.

Source

fn log( &self, status: Fmi3Status, category: M::LoggingCategory, args: Arguments<'_>, )

Log a message if the specified logging category is enabled.

Source

fn resource_path(&self) -> &PathBuf

Get the path to the resources directory.

Source

fn initialize(&mut self, start_time: f64, stop_time: Option<f64>)

Source

fn time(&self) -> f64

Get the current simulation time.

Source

fn set_time(&mut self, time: f64)

Set the current simulation time.

Source

fn stop_time(&self) -> Option<f64>

Get the simulation stop time, if any.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Provided Methods§

Source

fn early_return_allowed(&self) -> bool

Whether early return is allowed for this instance (relevant for CS).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M> Context<M> for BasicContext<M>
where M: UserModel + 'static,