-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move parsers to the library #24
Conversation
src/main.rs
Outdated
@@ -93,7 +93,7 @@ fn run() -> Result<(), Error> { | |||
.map(|v| usize::from_str(v).expect("Invalid head arguement")); | |||
|
|||
let filter = filter::from_args_profile(&args, &profile)?; | |||
let mut parser = parser::Parser::new(); | |||
let mut parser = parser::Parser::with_default_rules(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we should implement Default
.
src/parser.rs
Outdated
pub fn with_default_rules() -> Self { | ||
Parser { | ||
parsers: vec![ | ||
Box::new(formats::DefaultParser {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need the {}
src/parser.rs
Outdated
Box::new(formats::GTestParser {}), | ||
Box::new(formats::BugReportParser {}), | ||
], | ||
last: None, | ||
} | ||
} | ||
|
||
pub fn parse(&mut self, line: String) -> Record { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think changing this to &str
can avoid to move the String
. There is no need to actually move the line.
`serde_derive`. Works around the issue, when using `rogcat` as a library; see serde-rs/serde#1441
1. Implemented Default trait. 2. Removed unnecessary {}s. 3. Use &str instead of String.
No description provided.