Function index_ext::tag::with_ref

source ·
pub fn with_ref<'slice, T, U>(
    slice: &'slice [T],
    f: impl for<'r> FnOnce(&'slice Slice<T, Generative<'r>>, ExactSize<Generative<'r>>) -> U
) -> U
Expand description

Enter a region for soundly indexing a slice without bounds checks.

Prefer Generative::with_ref if possible.

The supplied function gets a freshly constructed pair of corresponding slice reference and length tag. It has no control over the exact lifetime used for the tag.