Struct darling::util::SpannedValue[][src]

pub struct SpannedValue<T> { /* fields omitted */ }

A value and an associated position in source code. The main use case for this is to preserve position information to emit warnings from proc macros. You can use a SpannedValue<T> as a field in any struct that implements or derives any of darling’s core traits.

To access the underlying value, use the struct’s Deref implementation.

Defaulting

This type is meant to be used in conjunction with attribute-extracted options, but the user may not always explicitly set those options in their source code. In this case, using Default::default() will create an instance which points to Span::call_site().

Implementations

impl<T> SpannedValue<T>[src]

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

pub fn span(&self) -> Span[src]

Get the source code location referenced by this struct.

Trait Implementations

impl<T> AsRef<T> for SpannedValue<T>[src]

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

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

impl<T> Default for SpannedValue<T> where
    T: Default
[src]

impl<T> Deref for SpannedValue<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for SpannedValue<T>[src]

impl<T> From<T> for SpannedValue<T> where
    T: Spanned
[src]

impl<T> FromDeriveInput for SpannedValue<T> where
    T: FromDeriveInput
[src]

impl<T> FromField for SpannedValue<T> where
    T: FromField
[src]

impl<T> FromGenericParam for SpannedValue<T> where
    T: FromGenericParam
[src]

impl<T> FromGenerics for SpannedValue<T> where
    T: FromGenerics
[src]

impl<T> FromMeta for SpannedValue<T> where
    T: FromMeta
[src]

impl<T> FromTypeParam for SpannedValue<T> where
    T: FromTypeParam
[src]

impl<T> FromVariant for SpannedValue<T> where
    T: FromVariant
[src]

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

Auto Trait Implementations

impl<T> !RefUnwindSafe for SpannedValue<T>

impl<T> !Send for SpannedValue<T>

impl<T> !Sync for SpannedValue<T>

impl<T> Unpin for SpannedValue<T> where
    T: Unpin

impl<T> UnwindSafe for SpannedValue<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.