Skip to main content

text_root

Function text_root 

Source
pub unsafe fn text_root(text: GcRef) -> (GcRef, usize)
Expand description

The root owned Text behind text, and the absolute offset at which text’s own bytes begin inside it.

A SourceSlice may name another SourceSlice, so “the owner” is in general a chain. The parser refuses to extend one: parse(t, P) over a t that is itself a slice would otherwise allocate slices of a slice, and every Text that parse produced would pay the chain’s depth on every read. Resolving once, when the Input is built, keeps every slice the interpreter allocates exactly one level deep.

§Safety

text must be a live Text GcRef, and every owner along its chain must point at a live Text.