From 93ba26e9a35bfadd5861ee6ff7201628f8fad622 Mon Sep 17 00:00:00 2001 From: Mike Tovino Date: Fri, 8 Aug 2025 14:54:47 -0600 Subject: [PATCH] update README example to match current implementation - the .build() call is required to align with recent rework of serialization - 'Type' was unused The example is intended to match the one in 'engine/src/lib.rs' - which has also been updated to remove the unused 'Type' and also 'rustfmt' the .build() call. --- engine/README.md | 17 ++++++++++------- engine/src/lib.rs | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/engine/README.md b/engine/README.md index b6ab898b..85396b8b 100644 --- a/engine/README.md +++ b/engine/README.md @@ -12,7 +12,7 @@ an executable IR and, finally, executing filters against provided values. ## Example ```rust -use wirefilter::{ExecutionContext, Scheme, Type}; +use wirefilter::{ExecutionContext, Scheme}; fn main() -> Result<(), Box> { // Create a map of possible filter fields. @@ -20,14 +20,17 @@ fn main() -> Result<(), Box> { http.method: Bytes, http.ua: Bytes, port: Int, - }; + } + .build(); // Parse a Wireshark-like expression into an AST. - let ast = scheme.parse(r#" - http.method != "POST" && - not http.ua matches "(googlebot|facebook)" && - port in {80 443} - "#)?; + let ast = scheme.parse( + r#" + http.method != "POST" && + not http.ua matches "(googlebot|facebook)" && + port in {80 443} + "#, + )?; println!("Parsed filter representation: {:?}", ast); diff --git a/engine/src/lib.rs b/engine/src/lib.rs index 10fadd50..64eb4f2c 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -6,7 +6,7 @@ //! # Example //! //! ``` -//! use wirefilter::{ExecutionContext, Scheme, Type}; +//! use wirefilter::{ExecutionContext, Scheme}; //! //! fn main() -> Result<(), Box> { //! // Create a map of possible filter fields. @@ -14,7 +14,8 @@ //! http.method: Bytes, //! http.ua: Bytes, //! port: Int, -//! }.build(); +//! } +//! .build(); //! //! // Parse a Wireshark-like expression into an AST. //! let ast = scheme.parse(