Skip to main content

text_bytes

Function text_bytes 

Source
pub unsafe fn text_bytes(payload: *const TextPayload) -> &'static [u8] 
Expand description

Read the UTF-8 bytes of a TextPayload, following slice owners.

For a TextPayload::Slice, this reads through the owner reference. This is sound because the GC is non-moving (ADR-011): the owner stays at its address as long as it is reachable, and the slice’s trace keeps it reachable.

§Safety

payload must point at a fully initialized, validly-linked TextPayload — every owner along the chain must point at a live Text object.