[][src]Enum cdshealpix::compass_point::MainWind

pub enum MainWind {
    S,
    SE,
    E,
    SW,
    C,
    NE,
    W,
    NW,
    N,
}

Main winds directions

Variants

S

South

SE

Southeast

E

East

SW

Southwest

C

Center (not a real main winds)

NE

Northeast

W

West

NW

Norhtwest

N

North

Methods

impl MainWind[src]

pub fn from_index(i: u8) -> MainWind[src]

Returns a Main wind direction give an index. We define this method for calls from external languages

  • 0 => S
  • 1 => SE
  • 2 => E
  • 3 => SW
  • 4 => C
  • 5 => NE
  • 6 => W
  • 7 => NW
  • 8 => N

Input

  • i index in [0, 8]

Output

  • main wind direction

Panics

If the given index in not in [0, 8]

Example

use cdshealpix::compass_point::{MainWind};
 
assert_eq!(MainWind::from_index(0), MainWind::S);
assert_eq!(MainWind::from_index(1), MainWind::SE);
assert_eq!(MainWind::from_index(2), MainWind::E);
assert_eq!(MainWind::from_index(3), MainWind::SW);
assert_eq!(MainWind::from_index(4), MainWind::C);
assert_eq!(MainWind::from_index(5), MainWind::NE);
assert_eq!(MainWind::from_index(6), MainWind::W);
assert_eq!(MainWind::from_index(7), MainWind::NW);
assert_eq!(MainWind::from_index(8), MainWind::N);

pub fn from_offsets(offset_se: i8, offset_sw: i8) -> MainWind[src]

Returns the given Main Wind direction according to the given offsets.

  • offset_se must be in [-1, 1]
  • offset_sw must be in [-1, 1]

Example

use cdshealpix::compass_point::MainWind;
use cdshealpix::compass_point::MainWind::{S, SE, E, SW, C, NE, W, NW, N};
 
assert_eq!(MainWind::from_offsets(-1, -1),  S);
assert_eq!(MainWind::from_offsets( 0, -1), SE);
assert_eq!(MainWind::from_offsets( 1, -1),  E);
assert_eq!(MainWind::from_offsets(-1,  0), SW);
assert_eq!(MainWind::from_offsets( 0,  0),  C);
assert_eq!(MainWind::from_offsets( 1,  0), NE);
assert_eq!(MainWind::from_offsets(-1,  1),  W);
assert_eq!(MainWind::from_offsets( 0,  1), NW);
assert_eq!(MainWind::from_offsets( 1,  1),  N);

Trait Implementations

impl PartialEq<MainWind> for MainWind[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Debug for MainWind[src]

Auto Trait Implementations

impl Send for MainWind

impl Sync for MainWind

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.