Skip to main content

pleiades_types/
frames.rs

1//! Coordinate frame and apparentness selectors: [`CoordinateFrame`] and [`Apparentness`].
2
3use core::fmt;
4
5/// The coordinate frame requested from a backend.
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
8#[non_exhaustive]
9pub enum CoordinateFrame {
10    /// Ecliptic longitude/latitude coordinates.
11    Ecliptic,
12    /// Equatorial right ascension/declination coordinates.
13    Equatorial,
14}
15
16impl fmt::Display for CoordinateFrame {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        let label = match self {
19            Self::Ecliptic => "Ecliptic",
20            Self::Equatorial => "Equatorial",
21        };
22        f.write_str(label)
23    }
24}
25
26/// Whether a backend should prefer apparent or mean values where both exist.
27#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
28#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
29#[non_exhaustive]
30pub enum Apparentness {
31    /// Apparent values, including light-time and related corrections when available.
32    Apparent,
33    /// Mean values.
34    Mean,
35}
36
37impl fmt::Display for Apparentness {
38    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39        let label = match self {
40            Self::Apparent => "Apparent",
41            Self::Mean => "Mean",
42        };
43        f.write_str(label)
44    }
45}