pub struct StringArena { /* private fields */ }Expand description
Bump allocator backing arena-owned AzString instances.
Every AzString returned by StringArena::intern holds a cloned
Arc to this arena; the backing bytes stay alive until the last
such AzString (and the arena handle itself) is dropped.
Intended use: create one arena per XML/HTML parse pass, intern all
tag names / attribute values / text content through it, then drop the
handle. The AzStrings embedded in the resulting StyledDom keep the
arena alive for as long as they need the bytes.
Implementations§
Source§impl StringArena
impl StringArena
Sourcepub const CHUNK_SIZE: usize
pub const CHUNK_SIZE: usize
Size of a freshly allocated chunk. Large enough that a typical DOM parse fits in 1-2 chunks, small enough to not over-allocate for small documents.
pub fn new() -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StringArena
impl !RefUnwindSafe for StringArena
impl Send for StringArena
impl Sync for StringArena
impl Unpin for StringArena
impl UnsafeUnpin for StringArena
impl !UnwindSafe for StringArena
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more