bump versions, apply clippy + fmt
This commit is contained in:
parent
b3fcafe944
commit
aa4aaba4c9
@ -1,9 +1,9 @@
|
||||
[package]
|
||||
name = "rust-dsn-parser"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version = "0.2.0"
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
xml-rs = "0.8.3"
|
||||
xml-rs = "1.0.0"
|
||||
30
src/model.rs
30
src/model.rs
@ -2,9 +2,9 @@ use std::convert::TryFrom;
|
||||
use std::io::BufReader;
|
||||
|
||||
use crate::DsnRespParseError;
|
||||
use xml::EventReader;
|
||||
use xml::attribute::OwnedAttribute;
|
||||
use xml::reader::XmlEvent;
|
||||
use xml::EventReader;
|
||||
|
||||
fn get_attr(attrs: &[OwnedAttribute], name: &str) -> Result<String, DsnRespParseError> {
|
||||
attrs
|
||||
@ -60,24 +60,15 @@ impl DsnResponse {
|
||||
if let Some(station) = station {
|
||||
stations.push(station);
|
||||
}
|
||||
station = Some(Station::try_from(attributes).unwrap());
|
||||
station = Some(Station::try_from(attributes)?);
|
||||
} else if name.local_name.contains("dish") {
|
||||
dish = Some(Dish::try_from(attributes).unwrap());
|
||||
dish = Some(Dish::try_from(attributes)?);
|
||||
} else if name.local_name.contains("downSignal") {
|
||||
dish = Some(
|
||||
dish.unwrap()
|
||||
.add_down_signal(Signal::try_from(attributes).unwrap()),
|
||||
);
|
||||
dish = Some(dish.unwrap().add_down_signal(Signal::try_from(attributes)?));
|
||||
} else if name.local_name.contains("upSignal") {
|
||||
dish = Some(
|
||||
dish.unwrap()
|
||||
.add_up_signal(Signal::try_from(attributes).unwrap()),
|
||||
);
|
||||
dish = Some(dish.unwrap().add_up_signal(Signal::try_from(attributes)?));
|
||||
} else if name.local_name.contains("target") {
|
||||
dish = Some(
|
||||
dish.unwrap()
|
||||
.add_target(Target::try_from(attributes).unwrap()),
|
||||
);
|
||||
dish = Some(dish.unwrap().add_target(Target::try_from(attributes)?));
|
||||
}
|
||||
}
|
||||
Ok(XmlEvent::EndElement { name }) => {
|
||||
@ -138,10 +129,11 @@ impl TryFrom<Vec<OwnedAttribute>> for Station {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Default)]
|
||||
pub enum SignalType {
|
||||
Data,
|
||||
Carrier,
|
||||
#[default]
|
||||
None,
|
||||
Unkown(String),
|
||||
}
|
||||
@ -157,12 +149,6 @@ impl From<String> for SignalType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SignalType {
|
||||
fn default() -> Self {
|
||||
SignalType::None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Signal {
|
||||
pub signal_type: SignalType,
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
pub use crate::model::*;
|
||||
pub use crate::DsnRespParseError;
|
||||
pub use crate::model::*;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user