Struct Span
pub struct Span<'a>(/* private fields */);
Expand description
A marker produced by SliceCache
that ensures that all resulting Span
s will be mutually
non-overlapping.
§Examples
let mut cache = SliceCache::new(4, |span| {
Box::new([span])
});
Implementations§
§impl<'a> Span<'a>
impl<'a> Span<'a>
pub fn slice<R>(&self, range: R) -> Option<Span<'a>>where
R: RangeBounds<usize>,
pub fn slice<R>(&self, range: R) -> Option<Span<'a>>where
R: RangeBounds<usize>,
cache span at mid
. Analogous to slice::split_at
.
§Examples
let mut cache = SliceCache::new(4, |span| {
let (left, right) = span.split_at(2);
Box::new([left, right])
});
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Span<'a>
impl<'a> RefUnwindSafe for Span<'a>
impl<'a> Send for Span<'a>
impl<'a> Sync for Span<'a>
impl<'a> Unpin for Span<'a>
impl<'a> !UnwindSafe for Span<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more