From b50170c4e4871789232c802b402ce44caf8e799d Mon Sep 17 00:00:00 2001 From: vthriller Date: Fri, 12 Jan 2018 22:41:56 +0300 Subject: [PATCH] no longer need main() --- .gitignore | 1 + Cargo.lock | 32 -------------------------------- src/lib.rs | 5 +++++ src/main.rs | 24 ------------------------ 4 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 Cargo.lock create mode 100644 src/lib.rs delete mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index eccd7b4..cd23ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target/ +Cargo.lock **/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 1ef365c..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,32 +0,0 @@ -[root] -name = "promql" -version = "0.1.0" -dependencies = [ - "nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libc" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memchr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nom" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)" = "96264e9b293e95d25bfcbbf8a88ffd1aedc85b754eba8b7d78012f638ba220eb" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..17ba485 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,5 @@ +#[macro_use] +extern crate nom; + +pub mod vec; +pub mod expr; diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index fca0edb..0000000 --- a/src/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -#[macro_use] -extern crate nom; - -mod vec; -mod expr; - -use nom::IResult; -use std::fmt::Debug; - -fn show(f: fn(&[u8]) -> IResult<&[u8], O, E>, s: &str) { - print!("{:?}\n", s); - match f(s.as_bytes()) { - IResult::Done(tail, res) => print!( - "Done({:#?},\n\t{:?},\n)", - res, - String::from_utf8(tail.to_vec()).unwrap() - ), - x => print!("{:?}", x), - } - print!("\n\n"); -} - -fn main() { -}