Skip to main content

AngleUnits

Trait AngleUnits 

Source
pub trait AngleUnits {
    // Required methods
    fn deg(&self) -> Result<Angle, AstroError>;
    fn rad(&self) -> Result<Angle, AstroError>;
    fn hours(&self) -> Result<Angle, AstroError>;
    fn arcmin(&self) -> Result<Angle, AstroError>;
    fn arcsec(&self) -> Result<Angle, AstroError>;
    fn dms(&self) -> Result<Angle, AstroError>;
    fn hms(&self) -> Result<Angle, AstroError>;
}
Expand description

Parse strings as angles with explicit unit specification.

Implemented for str. Each method interprets the string value in its respective unit.

§Decimal Methods

  • deg() - Parse as decimal degrees
  • rad() - Parse as radians
  • hours() - Parse as decimal hours (1h = 15 deg)
  • arcmin() - Parse as arcminutes (60’ = 1 deg)
  • arcsec() - Parse as arcseconds (3600“ = 1 deg)

§Sexagesimal Methods

  • hms() - Parse hours:minutes:seconds format
  • dms() - Parse degrees:minutes:seconds format

Required Methods§

Source

fn deg(&self) -> Result<Angle, AstroError>

Parse as decimal degrees.

Source

fn rad(&self) -> Result<Angle, AstroError>

Parse as radians.

Source

fn hours(&self) -> Result<Angle, AstroError>

Parse as decimal hours (1 hour = 15 degrees).

Source

fn arcmin(&self) -> Result<Angle, AstroError>

Parse as arcminutes (60 arcmin = 1 degree).

Source

fn arcsec(&self) -> Result<Angle, AstroError>

Parse as arcseconds (3600 arcsec = 1 degree).

Source

fn dms(&self) -> Result<Angle, AstroError>

Parse degrees-minutes-seconds format. See module docs for accepted formats.

Source

fn hms(&self) -> Result<Angle, AstroError>

Parse hours-minutes-seconds format. See module docs for accepted formats.

Implementations on Foreign Types§

Source§

impl AngleUnits for str

Implementors§