Skip to main content

net_predicate_evaluate_with_trace

Function net_predicate_evaluate_with_trace 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn net_predicate_evaluate_with_trace( predicate_json: *const c_char, tags_json: *const c_char, metadata_json: *const c_char, out_result: *mut c_int, out_trace_json: *mut *mut c_char, out_trace_len: *mut usize, ) -> c_int
Expand description

Evaluate a wire-format Predicate against (tags, metadata) and write a ClauseTrace tree to the out-param.

Mirrors Predicate::evaluate_with_trace(ctx). The trace preserves the planner’s short-circuit behavior: descendants that didn’t run are absent from the tree.

Inputs (NUL-terminated UTF-8 JSON):

  • predicate_json — wire-format PredicateWire.
  • tags_json — JSON array of tag strings.
  • metadata_json — JSON object of string -> string.

Outputs:

  • out_result — set to 1 if the predicate matched, 0 otherwise.
  • out_trace_json / out_trace_len — the trace tree’s JSON. Free with net_free_string. Wire shape: {"label": str, "result": bool, "children": [...]} recursively.

Returns 0 on success, NetError::* (negative) on failure.

§Safety

All input pointers MUST point at NUL-terminated UTF-8 strings valid for the duration of the call. out_* pointers must be writable; on success the caller owns the trace buffer and frees it via net_free_string.