[][src]Enum macro_input::DefaultValue

pub enum DefaultValue {
    Any(Option<Lit>),
    Flag,
    Str(Option<&'static str>),
    String(Option<String>),
    ByteStr(Option<&'static [u8]>),
    ByteString(Option<Vec<u8, Global>>),
    Byte(Option<u8>),
    Char(Option<char>),
    I32(Option<i32>),
    F32(Option<f32>),
    Bool(Option<bool>),
    Idents,
}

a default value for a Def

Variants

Any(Option<Lit>)

any literal

Flag

a flag that doesn't have a value eg #[my_input(enabled)]

Str(Option<&'static str>)

a string

String(Option<String>)

a string

a bytestring

ByteString(Option<Vec<u8, Global>>)

a bytestring

Byte(Option<u8>)

a u8

Char(Option<char>)

a char

I32(Option<i32>)

a i32

F32(Option<f32>)

a f32

Bool(Option<bool>)

a bool

Idents

a list of idents (default not supported)

Implementations

impl DefaultValue[src]

pub fn from_lit(ty: Type, lit: Option<Lit>) -> Result<DefaultValue, Error>[src]

construct a DefaultValue from a type and a literal

Errors

may return an error if the literal is not compatible with the type

#[must_use]pub fn ty(&self, optional: bool) -> Type[src]

get the type of the value

#[must_use]pub fn has_default_data(&self) -> bool[src]

checks whether the value is a default value

Trait Implementations

impl Clone for DefaultValue[src]

impl<'_> From<&'_ DefaultValue> for Types[src]

impl ToTokens for DefaultValue[src]

Auto Trait Implementations

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> Spanned for T where
    T: Spanned + ?Sized
[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.