Trait ExprExtension

Source
pub trait ExprExtension {
    // Required method
    fn get_self(&self) -> &Expr;

    // Provided methods
    fn as_unsigned_integer<T>(&self) -> Result<T>
       where T: FromStr,
             T::Err: Display { ... }
    fn as_signed_integer<T>(&self) -> Result<T>
       where T: FromStr + Neg<Output = T>,
             T::Err: Display { ... }
    fn as_unsigned_float<T>(&self) -> Result<T>
       where T: FromStr,
             T::Err: Display { ... }
    fn as_float<T>(&self) -> Result<T>
       where T: FromStr + Neg<Output = T>,
             T::Err: Display { ... }
    fn as_string(&self) -> Result<String> { ... }
    fn as_bool(&self) -> Result<bool> { ... }
    fn as_path(&self) -> Result<&Path> { ... }
}

Required Methods§

Source

fn get_self(&self) -> &Expr

Provided Methods§

Source

fn as_unsigned_integer<T>(&self) -> Result<T>
where T: FromStr, T::Err: Display,

Returns the integer value of the expression if it is a literal unsigned integer.

Source

fn as_signed_integer<T>(&self) -> Result<T>
where T: FromStr + Neg<Output = T>, T::Err: Display,

Returns the integer value of the expression if it is a literal signed integer.

Source

fn as_unsigned_float<T>(&self) -> Result<T>
where T: FromStr, T::Err: Display,

Source

fn as_float<T>(&self) -> Result<T>
where T: FromStr + Neg<Output = T>, T::Err: Display,

Source

fn as_string(&self) -> Result<String>

Returns the string value of the expression if it is a literal string.

Source

fn as_bool(&self) -> Result<bool>

Returns the boolean value of the expression if it is a literal bool.

Source

fn as_path(&self) -> Result<&Path>

Returns the path of the expression if it is a path.

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

Source§

fn get_self(&self) -> &Expr

Implementors§