[][src]Struct moore_common::source::Spanned

pub struct Spanned<T> {
    pub value: T,
    pub span: Span,
}

A wrapper that associates a span with a value.

Fields

value: Tspan: Span

Methods

impl<T> Spanned<T>
[src]

pub fn new(value: T, span: Span) -> Spanned<T>
[src]

Wrap a given value together with the span it covers.

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Spanned<U>
[src]

Map the spanned value, preserving the span.

pub fn map_into<U>(self) -> Spanned<U> where
    T: Into<U>, 
[src]

pub fn as_ref(&self) -> Spanned<&T>
[src]

Trait Implementations

impl<T> HasSpan for Spanned<T>
[src]

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]

fn desc_full(&self) -> String
[src]

Obtain a human-readable description for this node, possibly containing the node's name. Read more

impl<T: Eq> Eq for Spanned<T>
[src]

impl<T: PartialOrd> PartialOrd<Spanned<T>> for Spanned<T>
[src]

impl<T> Copy for Spanned<T> where
    T: Copy
[src]

impl<T: PartialEq> PartialEq<Spanned<T>> for Spanned<T>
[src]

impl<T> Clone for Spanned<T> where
    T: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Ord> Ord for Spanned<T>
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T> Debug for Spanned<T> where
    T: Debug
[src]

impl<T> Display for Spanned<T> where
    T: Display
[src]

impl<T> Hash for Spanned<T> where
    T: Hash
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Encodable> Encodable for Spanned<T>
[src]

impl<T: Decodable> Decodable for Spanned<T>
[src]

Auto Trait Implementations

impl<T> Send for Spanned<T> where
    T: Send

impl<T> Sync for Spanned<T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]