Skip to main content

extract_routing_field

Function extract_routing_field 

Source
pub fn extract_routing_field(
    payload: &[u8],
    field_name: &str,
) -> PreRouteExtraction
Available on crate feature worker-batch and (crate features worker-batch or worker-pool or worker) only.
Expand description

Extract a routing field from raw JSON bytes using SIMD.

Uses sonic_rs::get_from_slice for zero-copy extraction. The error path (distinguishing a missing field from invalid JSON) requires a full validity check and is intentionally cold.

§Behaviour

  • Ok(lazy_value) and value is a string → Found(string)
  • Ok(lazy_value) and value is not a string → Found(raw_str) (raw JSON)
  • Err with is_not_found()Missing
  • Err other → ParseError