-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
886512e
commit 5dffc62
Showing
15 changed files
with
92 additions
and
27,733 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "aeroweb" | ||
version = "0.1.5" | ||
version = "0.1.6" | ||
edition = "2021" | ||
authors = ["Adrian Tombu <[email protected]>"] | ||
keywords = ["meteo", "meteorology", "aeronautics", "aviation", "metar"] | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ pub mod sw; | |
pub mod tca; | ||
pub mod tcag; | ||
pub mod vaa; | ||
pub mod vag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use crate::error::Aeroweb; | ||
use crate::types::helpers::{de_option_link, de_option_string}; | ||
use serde::Deserialize; | ||
|
||
/// Retrieves volcanic hash warning graphics for a list of producing centers: | ||
/// - FMEE (La Réunion) | ||
/// - RJTD (Tokyo) | ||
// Definition file : https://aviation.meteo.fr/FR/aviation/XSD/vag.xsd | ||
// pub fn fetch() -> Result<Vag, AerowebError> {} | ||
|
||
/// Parses the XML string into a `Vag` struct. | ||
/// | ||
/// # Errors | ||
/// | ||
/// Returns an error if the XML string cannot be parsed. | ||
/// | ||
pub fn parse(xml: &str) -> Result<Vag, Aeroweb> { | ||
quick_xml::de::from_str(xml).map_err(Aeroweb::Deserialize) | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct Vag { | ||
#[serde(default, rename = "VAG")] | ||
pub centers: Vec<Center>, | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct Center { | ||
/// e.g. FMEE, RJTD | ||
#[serde(rename = "@oaci")] | ||
pub oaci: String, | ||
|
||
/// e.g. LA REUNION, TOKYO | ||
#[serde(rename = "@nom")] | ||
pub nom: String, | ||
|
||
/// e.g. 20240620210000 | ||
#[serde(rename = "@date_reception", deserialize_with = "de_option_string")] | ||
pub date_reception: Option<String>, | ||
|
||
#[serde(default, deserialize_with = "de_option_link")] | ||
pub lien: Option<String>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_dossier() { | ||
let data = std::fs::read_to_string("./data/vag.xml").unwrap(); | ||
let res = parse(&data); | ||
|
||
assert!(res.is_ok()); | ||
} | ||
} |