Skip to main content

GenericEngine

Struct GenericEngine 

Source
pub struct GenericEngine<A, R> { /* private fields */ }
Expand description

Typed storage and observable plumbing shared by concrete engines.

Mirrors the C++ GenericEngine<ArgumentsType, ResultsType>: carries the argument and result bundles and the engine’s observable, plus the observer half (the C++ update() { notifyObservers(); }) as a forwarder to register with the engine’s inputs via register_with. A concrete engine embeds one, delegates its PricingEngine accessors to it, and only implements calculate.

Implementations§

Source§

impl<A: Arguments, R: Results> GenericEngine<A, R>

Source

pub fn new(arguments: A, results: R) -> Self

Creates the engine base around its argument and result bundles.

Source

pub fn arguments(&self) -> &A

The typed argument bundle.

Source

pub fn arguments_mut(&mut self) -> &mut A

Mutable access to the typed argument bundle.

Source

pub fn results(&self) -> &R

The typed result bundle.

Source

pub fn results_mut(&mut self) -> &mut R

Mutable access to the typed result bundle.

Source

pub fn reset(&mut self)

Clears the results ahead of a calculation.

Source

pub fn register_with(&self, source: &Observable) -> bool

Registers the engine as an observer of source, so the source’s notifications are forwarded to the engine’s own observers (the C++ registerWith on an engine input).

Source

pub fn observer(&self) -> SharedMut<dyn Observer>

The engine as an observer, for registering with an input that exposes only observer registration (the C++ registerWith on a Handle).

Trait Implementations§

Source§

impl<A, R> AsObservable for GenericEngine<A, R>

Source§

fn observable(&self) -> &Observable

Access to the embedded observable for registering observers.

Auto Trait Implementations§

§

impl<A, R> !RefUnwindSafe for GenericEngine<A, R>

§

impl<A, R> !Send for GenericEngine<A, R>

§

impl<A, R> !Sync for GenericEngine<A, R>

§

impl<A, R> !UnwindSafe for GenericEngine<A, R>

§

impl<A, R> Freeze for GenericEngine<A, R>
where A: Freeze, R: Freeze,

§

impl<A, R> Unpin for GenericEngine<A, R>
where A: Unpin, R: Unpin,

§

impl<A, R> UnsafeUnpin for GenericEngine<A, R>
where A: UnsafeUnpin, R: UnsafeUnpin,

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