Skip to main content

process_cut_data_mut

Function process_cut_data_mut 

Source
pub fn process_cut_data_mut(
    data: &mut [u8],
    cfg: &CutConfig<'_>,
) -> Option<usize>
Expand description

In-place cut processing for mutable data buffers. Returns Some(new_length) if in-place processing succeeded, None if not supported for the given configuration (caller should fall back to regular processing).

In-place avoids allocating intermediate output buffers — the result is written directly into the input buffer (output is always <= input for non-complement modes with default output delimiter).

Note: if the input does not end with line_delim, we fall back to the regular path because GNU cut always adds a trailing line delimiter, and the in-place buffer cannot grow beyond the input size.