Struct EPWFile

Source
pub struct EPWFile {
    pub header: Header,
    pub data: WeatherData,
}
Expand description

EPWFile is the representation of the parsed file

it has only two attributes, header which is an instance of the Header struct, and data which contains the weather data in a WeatherData struct.

Fields§

§header: Header§data: WeatherData

Implementations§

Source§

impl EPWFile

Source

pub fn from_reader<R: BufRead>(reader: R) -> Result<Self, EPWParseError>

Construct an EPWFile instance from a buffered reader.

§Type Parameters
  • R: the type of the reader
§Parameters
  • reader: Reader that returns file contents.
§Returns

An initialized EPWReader or an EPWParseError

Source

pub fn from_path(path: &str) -> Result<Self, EPWParseError>

Create an EPWFile instance from a file path

§Parameters
  • path: Path to file on the filesystem
§Returns

An initialized EPWFile or an EPWParseError

Examples found in repository?
examples/example.rs (line 7)
6fn main() {
7    let parsed = EPWFile::from_path("./data/USA_FL_Tampa_TMY2.epw");
8    match parsed {
9        Ok(epw) => {
10            let location = epw.header.location;
11            let data = epw.data;
12            let max_temp = match data.dry_bulb_temperature.into_iter().reduce(f64::max) {
13                Some(t) => t,
14                None => panic!("Couldn't calculate max temperature"),
15            };
16            println!("Location:        {}", location);
17            println!("Max Temperature: {:.2}°C", max_temp);
18        }
19        Err(e) => println!("{:?}", e),
20    }
21}

Trait Implementations§

Source§

impl Debug for EPWFile

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.