Skip to main content

normalize

Function normalize 

Source
pub fn normalize(
    bytes: &[u8],
    max_bytes: usize,
) -> Result<String, NormalizationError>
Expand description

Normalize UTF-8 extractor bytes with an explicit input/output byte bound.

Matches Canic’s str::lines / trim_end contract: remove each line’s trailing Unicode whitespace, emit LF endings, and preserve blank lines. Empty input stays empty; a nonempty unterminated line gains one LF. This does not parse Candid or select an expected service contract.

§Errors

Returns input overflow, invalid UTF-8, normalized-output overflow or allocation failure. No partial normalized text is returned.