Skip to main content

compress_source

Function compress_source 

Source
pub fn compress_source(source: &str, lang: CompressLanguage) -> CompressResult
Expand description

Compress a source file by extracting declarations and signatures.

Returns compressed output or falls back to full content per the fallback rules:

  • Unsupported extension → full content
  • Parse error (NULL tree) → full content + warn
  • ERROR nodes in parse tree → full content + warn
  • Empty compressed output → full content + warn
  • Compressed ≥ original → full content (no warning)
  • tree-sitter panic → full content + warn (catch_unwind)