Struct moore_common::source::Spanned
source · [−]pub struct Spanned<T> {
pub value: T,
pub span: Span,
}
Expand description
A wrapper that associates a span with a value.
Fields
value: T
span: Span
Implementations
sourceimpl<T> Spanned<T>
impl<T> Spanned<T>
sourcepub fn new(value: T, span: Span) -> Spanned<T>
pub fn new(value: T, span: Span) -> Spanned<T>
Wrap a given value together with the span it covers.
sourcepub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Spanned<U>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Spanned<U>
Map the spanned value, preserving the span.
pub fn map_into<U>(self) -> Spanned<U> where
T: Into<U>,
pub fn as_ref(&self) -> Spanned<&T>
Trait Implementations
sourceimpl<T> HasSpan for Spanned<T>
impl<T> HasSpan for Spanned<T>
sourcefn human_span(&self) -> Span
fn human_span(&self) -> Span
Obtain a span which can be used to refer to this node in error messages
presented to humans. This will generally be the name for things like
entities, processes, and variables. Defaults to return whatever span()
returns. Read more
sourceimpl<T: Ord> Ord for Spanned<T>
impl<T: Ord> Ord for Spanned<T>
sourceimpl<T: PartialOrd> PartialOrd<Spanned<T>> for Spanned<T>
impl<T: PartialOrd> PartialOrd<Spanned<T>> for Spanned<T>
sourcefn partial_cmp(&self, other: &Spanned<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Spanned<T>) -> 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<T> Copy for Spanned<T> where
T: Copy,
impl<T: Eq> Eq for Spanned<T>
impl<T> StructuralEq for Spanned<T>
impl<T> StructuralPartialEq for Spanned<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Spanned<T> where
T: RefUnwindSafe,
impl<T> Send for Spanned<T> where
T: Send,
impl<T> Sync for Spanned<T> where
T: Sync,
impl<T> Unpin for Spanned<T> where
T: Unpin,
impl<T> UnwindSafe for Spanned<T> where
T: UnwindSafe,
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> 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