Skip to main content

parse_with_opts

Function parse_with_opts 

Source
pub fn parse_with_opts(
    input: &[u8],
    opts: &ParseOpts,
) -> Result<StatusContext, ParseError>
Expand description

Parse a statusline JSON payload into a StatusContext with caller hooks. Tool detection follows the precedence in docs/specs/input-schema.md §“Heuristic detection”: opts override → LINESMITH_TOOL env → shape heuristic → Fallback (ClaudeCode).

§Errors

Per ADR-0014, sub-field failures degrade to Option::None with lsm_warn! rather than propagating through Result. Returns Err only for catastrophic failures: ParseError::InvalidJson on malformed JSON, ParseError::TypeMismatch when the root is not a JSON object, and ParseError::InvalidValue for a used_percentage < 0 (carve-out for undocumented CC corruption signals; NaN is rejected upstream by serde_json as InvalidJson).