#[repr(transparent)]pub struct Span<'a>(_);Expand description
A marker produced by SliceCache that ensures that all resulting Spans will be mutually
non-overlapping.
Examples
let _cache = SliceCache::new(4, |span| {
Box::new([span])
});Implementations§
source§impl<'a> Span<'a>
impl<'a> Span<'a>
sourcepub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Option<Self>
pub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Option<Self>
cache span at mid. Analogous to slice::split_at.
Examples
let _cache = SliceCache::new(4, |span| {
let (left, right) = span.split_at(2);
Box::new([left, right])
});sourcepub fn split_at(&self, mid: usize) -> (Self, Self)
pub fn split_at(&self, mid: usize) -> (Self, Self)
cache span at mid. Analogous to slice::split_at.
Examples
let _cache = SliceCache::new(4, |span| {
let (left, right) = span.split_at(2);
Box::new([left, right])
});