Skip to main content

percent_decode_bytes_into

Function percent_decode_bytes_into 

Source
pub fn percent_decode_bytes_into<'a>(
    input: &[u8],
    buf: &'a mut [u8],
    plus_as_space: bool,
) -> Option<&'a [u8]>
Expand description

字节级百分号解码,结果写入调用方缓冲区(Preserve 策略,零堆分配)

非法 % 序列按原字节保留;plus_as_spacetrue+ 解码为空格。 不做 UTF-8 校验(调用方按需自行校验)。 供 WAF 等零堆分配热路径使用。

§Returns

  • Some(&buf[..n]) - 解码结果(借用调用方缓冲区)
  • None - 缓冲区不足(fail-closed,禁止截断后放行)