Struct calypso_base::span::Span
source · [−]pub struct Span { /* private fields */ }
Expand description
The location in a slice in which some object spans.
Implementations
sourceimpl 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
sourceimpl Ord for Span
impl Ord for Span
sourceimpl PartialOrd<Span> for Span
impl PartialOrd<Span> for Span
sourcefn partial_cmp(&self, other: &Span) -> Option<Ordering>
fn partial_cmp(&self, other: &Span) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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
impl Copy for Span
impl Eq for Span
impl StructuralEq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more