1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#![recursion_limit = "1000"] #[macro_use] extern crate pest; pub use pest::{Parser, StringInput}; mod parser; mod packet; pub use parser::{Rdp, ParserError}; pub use packet::{Location, WindSpeed, DataField, Packet}; pub fn parse(packet: &String) -> Result<Packet, ParserError> { let mut parser = Rdp::new(StringInput::new(packet)); match parser.packet() { true => Ok(parser.parse()), false => Err(ParserError::from_parser(&mut parser)), } }