Fmu

Struct Fmu 

Source
pub struct Fmu {
    pub model_description: FmiModelDescription,
    /* private fields */
}
Expand description

A unpacked FMU with a parsed model description.

Fields§

§model_description: FmiModelDescription

Parsed model description XML.

Implementations§

Source§

impl Fmu

Source

pub fn unpack(fmu_path: impl Into<PathBuf>) -> Result<Self, FmuUnpackError>

Unpack an FMU file to a tempdir and parse it’s model description.

Source

pub fn unpack_to( fmu_path: impl Into<PathBuf>, target_dir: impl Into<PathBuf>, ) -> Result<Self, FmuUnpackError>

Unpack an FMU file to a given target dir and parse it’s model description.

Source

pub fn load(self, simulation_type: fmi2Type) -> Result<FmuLibrary, FmuLoadError>

Load the FMU dynamic library.

Source

pub fn load_with_handler<F>( self, simulation_type: fmi2Type, handler: F, ) -> Result<FmuLibrary, FmuLoadError>
where F: FnOnce(&Library),

Load the FMU dynamic library, but pass in a handler to load custom symbols from the dynamic library before it’s passed to the runner.

This is useful for loading custom symbols and functions from the FMU library that are not part of the FMI standard.

§Example
let mut register_handler: Option<force_injector::RegisterHandlerFn> = None;
let fmu = Fmu::unpack(Path::new("./tests/fmu/planar_ball.fmu"))
    .unwrap()
    .load_with_handler(fmi2Type::fmi2CoSimulation, |lib| {
        register_handler = unsafe { lib.get(b"register_handler\0") }
            .map(|sym| *sym)
            .ok();
    })
    .unwrap();
Source

pub fn variables(&self) -> &HashMap<String, ScalarVariable>

Trait Implementations§

Source§

impl Debug for Fmu

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Fmu

§

impl RefUnwindSafe for Fmu

§

impl Send for Fmu

§

impl Sync for Fmu

§

impl Unpin for Fmu

§

impl UnwindSafe for Fmu

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