Skip to main content

ZeroCopyStr

Type Alias ZeroCopyStr 

Source
pub type ZeroCopyStr<'a> = Cow<'a, str>;
Expand description

String pool for deduplicating common strings during parsing Zero-copy string wrapper Zero-copy string wrapper that borrows when possible

This avoids allocating strings when we can reference the source data directly. Falls back to owned strings when necessary (e.g., escape processing).

Aliased Type§

pub enum ZeroCopyStr<'a> {
    Borrowed(&'a str),
    Owned(String),
}

Variants§

§1.0.0

Borrowed(&'a str)

Borrowed data.

§1.0.0

Owned(String)

Owned data.