Skip to main content

FromArg

Trait FromArg 

Source
pub trait FromArg: Sized {
    // Required method
    fn from_arg(arg: &Arg) -> Result<Self>;
}
Expand description

Converts a single Arg into a typed value.

Implement this trait to support a type as a field in #[derive(Attribute)] structs. Built-in impls cover bool, String, integer/float primitives, char, Ident, Path, Expr, LitStr, LitInt, Option<T>, Vec<T>, and Args.

Required Methods§

Source

fn from_arg(arg: &Arg) -> Result<Self>

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 FromArg for Expr

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for bool

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for char

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for f32

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for f64

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for i8

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for i16

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for i32

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for i64

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for i128

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for u8

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for u16

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for u32

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for u64

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for u128

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for String

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for Ident

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for LitInt

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for LitStr

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl FromArg for Path

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl<T: FromArg> FromArg for Option<T>

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Source§

impl<T: FromArg> FromArg for Vec<T>

Source§

fn from_arg(arg: &Arg) -> Result<Self>

Implementors§