Skip to main content

Observer

Trait Observer 

Source
pub trait Observer {
    // Provided methods
    fn step(&mut self, step: &dyn FlightStep) -> Result<(), SimError> { ... }
    fn event(&mut self, event: &FlightEvent) { ... }
    fn body_step(
        &mut self,
        body: usize,
        step: &dyn BodyStep,
    ) -> Result<(), SimError> { ... }
}
Expand description

Watches a flight as it runs. Every method does nothing by default; () watches nothing.

Provided Methods§

Source

fn step(&mut self, step: &dyn FlightStep) -> Result<(), SimError>

Sees every accepted integration step, in order.

§Errors

An error stops the flight and is returned from it.

Source

fn event(&mut self, event: &FlightEvent)

Sees every flight event as it is recorded.

Source

fn body_step( &mut self, body: usize, step: &dyn BodyStep, ) -> Result<(), SimError>

Sees every accepted integration step of a separated body’s flight to the ground, in order, the body numbered as crate::BodyFlight::body is.

§Errors

An error stops the flight and is returned from it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Observer for ()

Source§

impl<A: Observer, B: Observer> Observer for (A, B)

Two observers watch one flight: each sees every step and event, the first before the second.

Source§

fn step(&mut self, step: &dyn FlightStep) -> Result<(), SimError>

Source§

fn event(&mut self, event: &FlightEvent)

Source§

fn body_step( &mut self, body: usize, step: &dyn BodyStep, ) -> Result<(), SimError>

Source§

impl<T: Observer + ?Sized> Observer for &mut T

An observer lent to a flight, so the caller keeps it.

Source§

fn step(&mut self, step: &dyn FlightStep) -> Result<(), SimError>

Source§

fn event(&mut self, event: &FlightEvent)

Source§

fn body_step( &mut self, body: usize, step: &dyn BodyStep, ) -> Result<(), SimError>

Implementors§