diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2285792 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,79 @@ +name: Continuous integration + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + args: --all-features + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: build + args: --all-features + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - run: rustup component add clippy + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D -warnings diff --git a/Cargo.toml b/Cargo.toml index 3cfe935..f7feb4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "binator_network" authors = ["Stargateur"] -version = "0.0.0" +version = "0.0.1" description = "binator network" license = "Zlib" repository = "https://github.com/binator/network" @@ -19,11 +19,7 @@ include = [ ] [dependencies] -binator_core = "0.0.2" -binator_utils = "0.0.0" -binator_base = "0.0.0" -binator_context = "0.0.0" -binator_number = "0.0.0" +binator = "0.3.0" serde = { version = "1.0", optional = true, features = ["derive"] } const_format = { version = "0.2", features = ["const_generics"] } paste = "1" @@ -37,11 +33,7 @@ pretty_assertions = "1" derive-new = "0.5" derive_more = "0.99" -binator_core = { version = "0.0.2", features = ["tracing"]} -binator_utils = { version = "0.0.0", features = ["tracing"]} -binator_base = { version = "0.0.0", features = ["tracing"]} -binator_context = { version = "0.0.0", features = ["tracing"]} -binator_number = { version = "0.0.0", features = ["tracing"]} +binator = { version = "0.3.0", features = ["tracing"]} tracing = "0.1" tracing-subscriber = {version = "0.3", features = ["env-filter", "fmt"]} diff --git a/src/ether_type.rs b/src/ether_type.rs index ef9accd..475d75a 100755 --- a/src/ether_type.rs +++ b/src/ether_type.rs @@ -1,15 +1,15 @@ -use binator_base::octet; -use binator_core::{ +use binator::{ + base::octet, + utils::{ + Utils, + UtilsAtom, + }, Contexting, CoreAtom, Parse, Parsed, Streaming, }; -use binator_utils::{ - Utils, - UtilsAtom, -}; use crate::struct_variants; @@ -128,8 +128,10 @@ where #[cfg(test)] mod tests { - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use super::EtherType; diff --git a/src/ethernet.rs b/src/ethernet.rs index 1443eae..8841e1c 100644 --- a/src/ethernet.rs +++ b/src/ethernet.rs @@ -1,7 +1,11 @@ //! Handles parsing of Ethernet headers -use binator_base::octet; -use binator_core::{ +use binator::{ + base::octet, + utils::{ + Utils, + UtilsAtom, + }, Contexting, CoreAtom, Parse, @@ -9,10 +13,6 @@ use binator_core::{ Streaming, Success, }; -use binator_utils::{ - Utils, - UtilsAtom, -}; use crate::ether_type::{ ether_type, @@ -94,8 +94,10 @@ where #[cfg(test)] mod tests { - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use super::{ EtherType, diff --git a/src/ip_addr.rs b/src/ip_addr.rs index cc07498..cbcec57 100644 --- a/src/ip_addr.rs +++ b/src/ip_addr.rs @@ -8,10 +8,25 @@ use std::net::{ Ipv6Addr, }; -use binator_base::*; -use binator_core::*; -use binator_number::*; -use binator_utils::*; +use binator::{ + base::{ + is, + to_digit, + uint_radix, + BaseAtom, + IntRadixAtom, + Radix, + }, + utils::{ + Utils, + UtilsAtom, + }, + Contexting, + CoreAtom, + Parse, + Parsed, + Streaming, +}; /// Atom of ip_addr parser #[derive(Debug, Clone, PartialEq, Eq)] @@ -453,9 +468,11 @@ mod tests { str::FromStr, }; - use binator_base::*; - use binator_context::Tree; - use binator_core::*; + use binator::{ + base::*, + context::Tree, + *, + }; use derive_more::{ Display, From, diff --git a/src/ip_protocol.rs b/src/ip_protocol.rs index db5bb76..8ffe88e 100644 --- a/src/ip_protocol.rs +++ b/src/ip_protocol.rs @@ -1,14 +1,14 @@ //! Handles parsing of Internet Protocol fields (shared between ipv4 and ipv6) -use binator_base::octet; -use binator_core::{ +use binator::{ + base::octet, + utils::Utils, Contexting, CoreAtom, Parse, Parsed, Streaming, }; -use binator_utils::Utils; use crate::struct_variants; @@ -313,8 +313,10 @@ where #[cfg(test)] mod tests { - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use super::IPProtocol; diff --git a/src/ipv4.rs b/src/ipv4.rs index 0e727f8..8785037 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -8,14 +8,18 @@ use std::{ net::Ipv4Addr, }; -use binator_base::{ - any, - nbit, - octet, - NBit, -}; -use binator_core::{ - Acc, +use binator::{ + base::{ + any, + nbit, + octet, + NBit, + }, + utils::{ + Acc, + Utils, + UtilsAtom, + }, Contexting, CoreAtom, Parse, @@ -23,10 +27,6 @@ use binator_core::{ Streaming, Success, }; -use binator_utils::{ - Utils, - UtilsAtom, -}; use crate::ip_protocol::{ self, @@ -274,8 +274,10 @@ where mod tests { use std::net::Ipv4Addr; - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use super::{ IPProtocol, diff --git a/src/ipv6.rs b/src/ipv6.rs index 443de79..e47832b 100644 --- a/src/ipv6.rs +++ b/src/ipv6.rs @@ -8,12 +8,16 @@ use std::{ net::Ipv6Addr, }; -use binator_base::{ - nbit, - octet, - NBit, -}; -use binator_core::{ +use binator::{ + base::{ + nbit, + octet, + NBit, + }, + utils::{ + Utils, + UtilsAtom, + }, Contexting, CoreAtom, Parse, @@ -21,10 +25,6 @@ use binator_core::{ Streaming, Success, }; -use binator_utils::{ - Utils, - UtilsAtom, -}; use crate::ip_protocol::{ self, @@ -178,8 +178,10 @@ where mod tests { use std::net::Ipv6Addr; - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use pretty_assertions::assert_eq; use super::{ diff --git a/src/lib.rs b/src/lib.rs index 0ec61d2..5548254 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,19 +120,19 @@ pub(crate) use struct_variants; mod tests { use core::fmt::Debug; - use binator_base::{ - all, - BaseAtom, - }; - use binator_context::Tree; - use binator_core::{ + use binator::{ + base::{ + all, + BaseAtom, + IntRadixAtom, + }, + context::Tree, + utils::UtilsAtom, CoreAtom, Parse, Streaming, Success, }; - use binator_number::IntRadixAtom; - use binator_utils::UtilsAtom; use derive_more::{ Display, From, diff --git a/src/tcp.rs b/src/tcp.rs index e5d196a..678327c 100644 --- a/src/tcp.rs +++ b/src/tcp.rs @@ -6,14 +6,23 @@ use std::fmt::{ Formatter, }; -use binator_base::{ - any, - is, - octet, - BaseAtom, -}; -use binator_core::{ - Acc, +use binator::{ + base::{ + any, + is, + octet, + primitive::{ + u16_be, + u32_be, + }, + BaseAtom, + IntRadixAtom, + }, + utils::{ + Acc, + Utils, + UtilsAtom, + }, Contexting, CoreAtom, Parse, @@ -21,15 +30,6 @@ use binator_core::{ Streaming, Success, }; -use binator_number::{ - u16_be, - u32_be, - IntRadixAtom, -}; -use binator_utils::{ - Utils, - UtilsAtom, -}; /// Meta trait for tcp combinator pub trait TcpParse = where @@ -505,16 +505,18 @@ where mod tests { use core::fmt::Debug; - use binator_base::BaseAtom; - use binator_context::Tree; - use binator_core::{ + use binator::{ + base::{ + BaseAtom, + IntRadixAtom, + }, + context::Tree, + utils::UtilsAtom, CoreAtom, Parse, Parsed, Streaming, }; - use binator_number::IntRadixAtom; - use binator_utils::UtilsAtom; use derive_more::{ Display, From, diff --git a/src/udp.rs b/src/udp.rs index 337f30e..0c2aa0e 100644 --- a/src/udp.rs +++ b/src/udp.rs @@ -1,6 +1,8 @@ //! Handles parsing of UDP header -use binator_core::{ +use binator::{ + base::primitive::u16_be, + utils::UtilsAtom, Contexting, CoreAtom, Parse, @@ -8,8 +10,6 @@ use binator_core::{ Streaming, Success, }; -use binator_number::u16_be; -use binator_utils::UtilsAtom; /// Data of a UDP Header #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -62,8 +62,10 @@ where #[cfg(test)] mod tests { - use binator_context::Ignore; - use binator_core::Parsed; + use binator::{ + context::Ignore, + Parsed, + }; use super::UdpHeader;