Skip to main content

collect_with_truncation

Function collect_with_truncation 

Source
pub fn collect_with_truncation(
    output: &mut String,
    new_content: &str,
    max_size: usize,
    truncated: &mut bool,
) -> bool
Expand description

Collect content with lazy truncation (Codex pattern). Marks truncated but continues draining to prevent pipe blocking.

§Arguments

  • output - Accumulated output buffer
  • new_content - New content to append
  • max_size - Maximum allowed size
  • truncated - Mutable flag tracking truncation state

§Returns

true if content was appended, false if truncated