Skip to main content

parse_hook_descriptor

Function parse_hook_descriptor 

Source
pub fn parse_hook_descriptor(
    descriptor: &str,
) -> Result<(FqlPattern, HookPoint), String>
Expand description

Parses a hook descriptor shorthand into FQL pattern and HookPoint.

Uses known-prefix matching (ADR 16.2 B案) to split the FQL part from the HookPoint suffix at the last : whose right-hand side starts with one of HookPoint::KNOWN_PREFIXES.

§Examples

let (fql, point) = parse_hook_descriptor("builtin::llm:request.pre_dispatch").unwrap();
assert_eq!(fql.to_string(), "builtin::llm");
assert_eq!(point.to_string(), "request.pre_dispatch");