Struct SyntheticInstrument_API

Source
#[repr(C)]
pub struct SyntheticInstrument_API(/* private fields */);
Expand description

C compatible Foreign Function Interface (FFI) for an underlying SyntheticInstrument.

This struct wraps SyntheticInstrument in a way that makes it compatible with C function calls, enabling interaction with SyntheticInstrument in a C environment.

It implements the Deref trait, allowing instances of SyntheticInstrument_API to be dereferenced to SyntheticInstrument, providing access to SyntheticInstruments’s methods without having to manually access the underlying instance.

Methods from Deref<Target = SyntheticInstrument>§

Source

pub fn is_valid_formula(&self, formula: &str) -> bool

Source

pub fn change_formula(&mut self, formula: String) -> Result<()>

§Errors

Returns an error if parsing the new formula fails.

Source

pub fn calculate_from_map( &mut self, inputs: &HashMap<String, f64>, ) -> Result<Price>

Calculates the price of the synthetic instrument based on component input prices provided as a map.

§Panics

Panics if a required component price is missing from the input map, or if setting the value in the evaluation context fails.

§Errors

Returns an error if formula evaluation fails.

Source

pub fn calculate(&mut self, inputs: &[f64]) -> Result<Price>

Calculates the price of the synthetic instrument based on the given component input prices provided as an array of f64 values.

§Errors

Returns an error if the input length does not match or formula evaluation fails.

Trait Implementations§

Source§

impl Debug for SyntheticInstrument_API

Source§

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

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

impl Deref for SyntheticInstrument_API

Source§

type Target = SyntheticInstrument

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for SyntheticInstrument_API

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

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, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,