Function tracing_capture::predicates::value

source ·
pub fn value<T, P>(matches: P) -> ValuePredicate<T, P>
where T: for<'a> FromTracedValue<'a> + ?Sized, P: Predicate<T>,
Expand description

Creates a predicate for a TracedValue that checks whether the value matches the specified criteria for a particular subtype (e.g., an unsigned integer). If the value has another subtype, the predicate is false.

Returned predicates can be supplied to the field() function.

§Arguments

The argument must be a predicate for one of types that can be obtained from a TracedValue reference: bool, i64, i128, u64, u128, f64, or str. The type can be specified explicitly, but usually you can make Rust properly infer it.

§Examples

let _ = field("return", value(gt(5.0)));
let _ = field("name", value(contains("test")));
let _ = field("float", value(in_hash([3_u64, 5])));
// ^ Note the specified integer type.