Trait FromLit

Source
pub trait FromLit: Sized {
    // Required method
    fn from(lit: Option<Lit>) -> Result<Self>;
}
Expand description

a trait for extracting a value from a literal

FromMeta is automatically implemented for all implementations

Required Methods§

Source

fn from(lit: Option<Lit>) -> Result<Self>

extract the value

§Errors

may return an Error if the literal doesn’t contain the correct value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromLit for Option<Lit>

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for bool

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for char

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for f32

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for i32

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for u8

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for String

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl FromLit for Vec<u8>

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Source§

impl<V: FromLit> FromLit for Option<V>

Source§

fn from(lit: Option<Lit>) -> Result<Self>

Implementors§