pub struct JqExtraction { /* private fields */ }Expand description
A compiled jq expression for extracting values from JSON bodies.
Includes a custom hash function for hashing extracted values.
§Examples
use hitbox_http::extractors::body::JqExtraction;
// Extract user ID from JSON body
let extraction = JqExtraction::compile(".user.id").unwrap();
// Extract and hash a sensitive field
let extraction = JqExtraction::compile(".password | hash").unwrap();Implementations§
Source§impl JqExtraction
impl JqExtraction
Sourcepub fn compile(expression: &str) -> Result<Self, String>
pub fn compile(expression: &str) -> Result<Self, String>
Compiles a jq expression for extracting values from JSON bodies.
The compiled filter can be reused across multiple requests.
§Errors
Returns Err(String) if the expression is invalid:
- Parse errors (syntax errors in the jq expression)
- Compile errors (undefined functions, type mismatches)
The error message includes details about the parsing or compilation failure.
Trait Implementations§
Source§impl Clone for JqExtraction
impl Clone for JqExtraction
Source§fn clone(&self) -> JqExtraction
fn clone(&self) -> JqExtraction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for JqExtraction
impl RefUnwindSafe for JqExtraction
impl Send for JqExtraction
impl Sync for JqExtraction
impl Unpin for JqExtraction
impl UnwindSafe for JqExtraction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more