Struct calypso_base::span::Span
source · Expand description
The location in a slice in which some object spans.
Fields§
§lo: u32
§hi: u32
Implementations§
source§impl Span
impl Span
sourcepub fn new_shrunk(amount: u32) -> Self
pub fn new_shrunk(amount: u32) -> Self
Create a new empty span around an index.
sourcepub fn shrink_to_lo(self) -> Span
pub fn shrink_to_lo(self) -> Span
Returns a new span representing an empty span at the beginning of this span
sourcepub fn shrink_to_hi(self) -> Span
pub fn shrink_to_hi(self) -> Span
Returns a new span representing an empty span at the end of this span.
sourcepub fn substitute_dummy(self, other: Span) -> Span
pub fn substitute_dummy(self, other: Span) -> Span
Returns self
if self
is not a dummy span, and other
otherwise.
sourcepub fn to(self, end: Span) -> Span
pub fn to(self, end: Span) -> Span
Returns a Span
that would enclose both self
and end
.
____ ___
self lorem ipsum end
^^^^^^^^^^^^^^^^^^^^
sourcepub fn between(self, end: Span) -> Span
pub fn between(self, end: Span) -> Span
Returns a Span
between the end of self
to the beginning of end
.
____ ___
self lorem ipsum end
^^^^^^^^^^^^^
sourcepub fn until(self, end: Span) -> Span
pub fn until(self, end: Span) -> Span
Returns a Span
from the beginning of self
until the beginning of end
.
____ ___
self lorem ipsum end
^^^^^^^^^^^^^^^^^
sourcepub fn sub_hi(self, amount: u32) -> Span
pub fn sub_hi(self, amount: u32) -> Span
Subtract the given amount from the high index of a span.
sourcepub fn sub_lo(self, amount: u32) -> Span
pub fn sub_lo(self, amount: u32) -> Span
Subtract the given amount from the low index of a span.
sourcepub fn into_range(self) -> Range<usize>
pub fn into_range(self) -> Range<usize>
Convert to a Range
. (This function present to prevent generics
hell.)
Trait Implementations§
source§impl Ord for Span
impl Ord for Span
source§impl PartialEq<Span> for Span
impl PartialEq<Span> for Span
source§impl PartialOrd<Span> for Span
impl PartialOrd<Span> for Span
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more