Struct StationInfo

Source
pub struct StationInfo { /* private fields */ }
๐Ÿ‘ŽDeprecated
Expand description

Station information including location data and identification number.

Implementationsยง

Sourceยง

impl StationInfo

Source

pub fn new_with_values<T, U, V, W>( station_num: T, location: U, elevation: V, ) -> Self
where T: Into<Optioned<i32>>, U: Into<Option<(f64, f64)>>, Optioned<W>: From<V>, W: Noned + Length, Meters: From<W>,

๐Ÿ‘ŽDeprecated

Create a new StationInfo object.

ยงArguments

station_num: The USAF station identifier, or None.

location: The latitude and longitude as a tuple, or None.

elevation: The elevation of the station in meters.

ยงExamples
use metfor::{Meters, Feet};
use sounding_base::StationInfo;
use optional::{some, none};

let _stn = StationInfo::new_with_values(12345, (45.2,-113.5), Meters(2000.0));
let _stn = StationInfo::new_with_values(12345, (45.2,-113.5), Feet(2000.0));
let _stn = StationInfo::new_with_values(12345, (45.2,-113.5), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(12345, (45.2,-113.5), some(Feet(2000.0)));
let _stn = StationInfo::new_with_values(12345, Some((45.2,-113.5)), Meters(2000.0));
let _stn = StationInfo::new_with_values(12345, Some((45.2,-113.5)), Feet(2000.0));
let _stn = StationInfo::new_with_values(12345, Some((45.2,-113.5)), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(12345, Some((45.2,-113.5)), some(Feet(2000.0)));
let _stn = StationInfo::new_with_values(Some(12345), None, Meters(2000.0));
let _stn = StationInfo::new_with_values(Some(12345), None, Feet(2000.0));
let _stn = StationInfo::new_with_values(None, (45.2,-113.5), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(None, (45.2,-113.5), some(Feet(2000.0)));

// Note that lat-lon is an `Option` and not an `Optioned`
let _stn = StationInfo::new_with_values(some(12345), None, none::<Feet>());
let _stn = StationInfo::new_with_values(some(12345), None, none::<Meters>());
Source

pub fn new() -> Self

๐Ÿ‘ŽDeprecated

Create a new object with default values.

ยงExamples
use sounding_base::StationInfo;

assert!(StationInfo::new().station_num().is_none());
assert!(StationInfo::new().location().is_none());
assert!(StationInfo::new().elevation().is_none());
Source

pub fn with_station<T>(self, number: T) -> Self
where Optioned<i32>: From<T>,

๐Ÿ‘ŽDeprecated

Builder method to add a station number.

ยงExamples
use sounding_base::StationInfo;

assert_eq!(StationInfo::new().with_station(12345).station_num().unwrap(), 12345);
assert_eq!(StationInfo::new().with_station(Some(12345)).station_num().unwrap(), 12345);
Source

pub fn with_lat_lon<T>(self, coords: T) -> Self
where Option<(f64, f64)>: From<T>,

๐Ÿ‘ŽDeprecated

Builder method to add a location.

ยงExamples
use sounding_base::StationInfo;

assert_eq!(
    StationInfo::new().with_lat_lon((45.0, -116.0)).location().unwrap(), (45.0, -116.0));
assert_eq!(
    StationInfo::new().with_lat_lon(Some((45.0, -116.0)))
        .location()
        .unwrap(),
    (45.0, -116.0));
Source

pub fn with_elevation<T, U>(self, elev: T) -> Self
where Optioned<U>: From<T>, U: Noned + Length, Meters: From<U>,

๐Ÿ‘ŽDeprecated

Builder method to add elevation.

ยงExamples
 use metfor::{Meters, Feet, Km};
 use sounding_base::StationInfo;
 use optional::{some, none};

 let _info = StationInfo::new().with_elevation(Feet(200.0));
 let _info = StationInfo::new().with_elevation(Meters(200.0));
 let _info = StationInfo::new().with_elevation(Km(2.0));
 let _info = StationInfo::new().with_elevation(some(Feet(200.0)));
 let _info = StationInfo::new().with_elevation(some(Meters(200.0)));
 let _info = StationInfo::new().with_elevation(some(Km(2.0)));
 let _info = StationInfo::new().with_elevation(none::<Feet>());
 let _info = StationInfo::new().with_elevation(none::<Meters>());
 let _info = StationInfo::new().with_elevation(none::<Km>());
Source

pub fn station_num(&self) -> Optioned<i32>

๐Ÿ‘ŽDeprecated

station number, USAF number, eg 727730

Source

pub fn location(&self) -> Option<(f64, f64)>

๐Ÿ‘ŽDeprecated

Latitude and longitude.

Source

pub fn elevation(&self) -> Optioned<Meters>

๐Ÿ‘ŽDeprecated

Elevation in meters, this may be in model terrain, not necessarily the same as the real world.

Trait Implementationsยง

Sourceยง

impl Clone for StationInfo

Sourceยง

fn clone(&self) -> StationInfo

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for StationInfo

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for StationInfo

Sourceยง

fn default() -> StationInfo

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl PartialEq for StationInfo

Sourceยง

fn eq(&self, other: &StationInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl Copy for StationInfo

Sourceยง

impl StructuralPartialEq for StationInfo

Auto Trait Implementationsยง

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.