Skip to main content

EclipseEngine

Struct EclipseEngine 

Source
pub struct EclipseEngine<B> { /* private fields */ }
Expand description

Searches for global/geocentric eclipses over a chosen EphemerisBackend.

Backed by the packaged data, results are valid only within the 1900-01-01..2100-01-01 window (see crate); out-of-window requests fail closed with EclipseError::OutOfWindow.

Implementations§

Source§

impl<B: EphemerisBackend> EclipseEngine<B>

Source

pub fn new(backend: B) -> Self

Creates an engine that draws Sun/Moon positions from backend.

Source

pub fn eclipses_in_range( &self, start: Instant, end: Instant, filter: EclipseFilter, ) -> Result<Vec<Eclipse>, EclipseError>

Returns every eclipse admitted by filter with greatest eclipse in [start, end] (both bounds inclusive), in chronological order. Fails closed if either bound is outside the supported window.

Selection is by the greatest-eclipse instant, not by the new/full moon that precedes or follows it by minutes, and that instant does not depend on the range searched. Adjacent ranges that meet at an instant therefore partition the eclipses between them, except that an eclipse whose greatest instant falls exactly on the shared bound appears in both.

Source

pub fn next_eclipse( &self, after: Instant, filter: EclipseFilter, ) -> Result<Option<Eclipse>, EclipseError>

Returns the first eclipse admitted by filter whose greatest eclipse is strictly after after, or None if none remains before the window end. Fails closed if after is outside the supported window.

The cost grows with the distance to the eclipse found, not to the window end.

Source

pub fn previous_eclipse( &self, before: Instant, filter: EclipseFilter, ) -> Result<Option<Eclipse>, EclipseError>

Returns the last eclipse admitted by filter whose greatest eclipse is strictly before before, or None if none exists after the window start. Fails closed if before is outside the supported window.

The cost grows with the distance to the eclipse found, not to the window start.

Source

pub fn local_circumstances( &self, eclipse: &Eclipse, observer: &ObserverLocation, atmosphere: Atmosphere, ) -> Result<LocalCircumstances, EclipseError>

Local (per-observer) circumstances for an already-found eclipse.

Returns full circumstances even when the eclipse is not visible from observer (all contacts below the horizon); inspect any_phase_visible (via the returned variant) to test visibility. Solar contact instants are observer-dependent (topocentric); lunar contact instants are global with per-observer visibility.

atmosphere is pleiades_apparent::Atmosphere from the pleiades-apparent release this crate pins (0.7 and later); build it from that same release.

Source

pub fn next_local_eclipse( &self, after: Instant, observer: &ObserverLocation, filter: EclipseFilter, atmosphere: Atmosphere, ) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>

The next eclipse admitted by filter, strictly after after, that is locally visible from observer (any phase above the horizon), paired with its local circumstances. Walks the global next_eclipse sequence and returns the first locally-visible one, so the result is a strict refinement of the global engine.

Source

pub fn previous_local_eclipse( &self, before: Instant, observer: &ObserverLocation, filter: EclipseFilter, atmosphere: Atmosphere, ) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>

The previous eclipse admitted by filter, strictly before before, that is locally visible from observer, paired with its local circumstances.

Auto Trait Implementations§

§

impl<B> Freeze for EclipseEngine<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for EclipseEngine<B>
where B: RefUnwindSafe,

§

impl<B> Send for EclipseEngine<B>
where B: Send,

§

impl<B> Sync for EclipseEngine<B>
where B: Sync,

§

impl<B> Unpin for EclipseEngine<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for EclipseEngine<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for EclipseEngine<B>
where B: UnwindSafe,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.