Struct moore_common::source::Spanned
[−]
[src]
pub struct Spanned<T> { pub value: T, pub span: Span, }
A wrapper that associates a span with a value.
Fields
value: T
span: Span
Methods
impl<T> Spanned<T>
[src]
fn new(value: T, span: Span) -> Spanned<T>
[src]
Wrap a given value together with the span it covers.
fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Spanned<U>
[src]
Map the spanned value, preserving the span.
fn map_into<U>(self) -> Spanned<U> where
T: Into<U>,
[src]
T: Into<U>,
fn as_ref(&self) -> Spanned<&T>
[src]
Trait Implementations
impl<T: PartialOrd> PartialOrd for Spanned<T>
[src]
fn partial_cmp(&self, __arg_0: &Spanned<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord> Ord for Spanned<T>
[src]
fn cmp(&self, __arg_0: &Spanned<T>) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl<T: PartialEq> PartialEq for Spanned<T>
[src]
fn eq(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Spanned<T>) -> bool
[src]
This method tests for !=
.
impl<T: Eq> Eq for Spanned<T>
[src]
impl<T: Encodable> Encodable for Spanned<T>
[src]
fn encode<__ST: Encoder>(&self, __arg_0: &mut __ST) -> Result<(), __ST::Error>
[src]
Serialize a value using an Encoder
.
impl<T: Decodable> Decodable for Spanned<T>
[src]
fn decode<__DT: Decoder>(__arg_0: &mut __DT) -> Result<Spanned<T>, __DT::Error>
[src]
Deserialize a value using a Decoder
.
impl<T> Debug for Spanned<T> where
T: Debug,
[src]
T: Debug,
impl<T> Copy for Spanned<T> where
T: Copy,
[src]
T: Copy,
impl<T> Clone for Spanned<T> where
T: Clone,
[src]
T: Clone,
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> HasSpan for Spanned<T>
[src]
fn span(&self) -> Span
[src]
Obtain the full span of the input file that this node covers.
fn human_span(&self) -> Span
[src]
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
impl<T> HasDesc for Spanned<T> where
T: HasDesc,
[src]
T: HasDesc,