pub struct Span<'a>(/* private fields */);Expand description
A marker produced by SliceCache that ensures that all resulting Spans will be mutually
non-overlapping.
§Examples
let mut 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 mut 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 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more