Skip to main content

Module static_slices

Module static_slices 

Source
Expand description

ALTREP impls for &'static [T].

Static slices are Sized (fat pointer: ptr + len) and satisfy 'static, so they work directly with the ExternalPtr-backed ALTREP machinery. These impls are hand-written rather than macro-generated because the writable dataptr path must assert !writable (static data is immutable).

Use cases: const arrays via &DATA[..], leaked vectors via Box::leak(vec.into_boxed_slice()), memory-mapped files with 'static lifetime.