gnss_rs/
macros.rs

1/// Creates a [crate::prelude::SV] from given (case insensitive) string description.
2/// Example:
3/// ```
4/// use std::str::FromStr;
5/// use gnss_rs::prelude::*;
6/// use gnss_rs::sv; // macro
7/// assert_eq!(sv!("G08").constellation, Constellation::GPS);
8/// assert_eq!(sv!("G08").prn, 8);
9/// assert_eq!(sv!("e05").constellation, Constellation::Galileo);
10/// assert_eq!(sv!("e05").prn, 5);
11/// ```
12#[macro_export]
13macro_rules! sv {
14    ($desc: expr) => {
15        SV::from_str($desc).unwrap()
16    };
17}
18
19/// Creates a [crate::prelude::Constellation] from given (case insensitive) string description.
20/// Example:
21/// ```
22/// use std::str::FromStr;
23/// use gnss_rs::prelude::*;
24/// use gnss_rs::gnss; // macro
25/// assert_eq!(gnss!("gps"), Constellation::GPS);
26/// assert_eq!(gnss!("Gal"), Constellation::Galileo);
27/// assert_eq!(gnss!("GALILEO"), Constellation::Galileo);
28/// ```
29#[macro_export]
30macro_rules! gnss {
31    ($desc: expr) => {
32        Constellation::from_str($desc).unwrap()
33    };
34}