From: Pierre Chifflier Date: Wed, 30 Oct 2019 16:17:32 +0000 (+0100) Subject: rust: add take_until_and_consume replacement function X-Git-Tag: suricata-6.0.0-beta1~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=030c9a3d865f1252c4ee666a307103e55273004c;p=thirdparty%2Fsuricata.git rust: add take_until_and_consume replacement function --- diff --git a/rust/src/common.rs b/rust/src/common.rs new file mode 100644 index 0000000000..3ed1ef38ff --- /dev/null +++ b/rust/src/common.rs @@ -0,0 +1,12 @@ +#[macro_export] +macro_rules! take_until_and_consume ( + ( $i:expr, $needle:expr ) => ( + { + let input: &[u8] = $i; + + let (rem, res) = ::nom::take_until!(input, $needle)?; + let (rem, _) = ::nom::take!(rem, $needle.len())?; + Ok((rem, res)) + } + ); +); diff --git a/rust/src/lib.rs b/rust/src/lib.rs index e0955b1a41..81ada2101c 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -40,6 +40,8 @@ pub mod log; #[macro_use] pub mod core; +#[macro_use] +pub mod common; pub mod conf; pub mod json; #[macro_use]