Skip to content
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

Merged
merged 3 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ indicatif = "0.11.0"
lazy_static = "1.3.0"
nom = "4.2.3"
regex = "1.1.6"
serde = "1.0.91"
serde_derive = "1.0.91"
serde = { version = "1.0.91", features = ['derive'] }
serde_json = "1.0.39"
term_size = "0.3.1"
time = "0.1.42"
Expand Down
2 changes: 1 addition & 1 deletion src/filewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ mod html {
RenderError,
};
use rogcat::record::{Format, Record};
use serde_derive::Serialize;
use serde::Serialize;
use serde_json::value::{Map, Value as Json};
use std::{
fs::File,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
// SOFTWARE.

pub mod record;
pub mod parser;
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use failure::Error;
use futures::{sync::oneshot, Future, Sink, Stream};
use rogcat::record::*;
use rogcat::parser;
use std::{process::exit, str::FromStr};
use tokio::runtime::Runtime;
use tokio_signal::ctrl_c;
Expand All @@ -30,7 +31,6 @@ mod cli;
mod filewriter;
mod filter;
mod lossy_lines;
mod parser;
mod profiles;
mod reader;
mod subcommands;
Expand Down Expand Up @@ -93,13 +93,13 @@ 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 = Default::default();

let mut runtime = Runtime::new()?;

let f = source
.map(move |a| match a {
StreamData::Line(l) => parser.parse(l),
StreamData::Line(l) => parser.parse(&l),
StreamData::Record(r) => r,
})
.filter(move |r| filter.filter(r))
Expand Down
Loading