Trait ExprExtension

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

    // Provided methods
    fn as_literal_integer<T>(&self) -> Result<T>
       where T: FromStr,
             T::Err: Display { ... }
    fn as_literal_string(&self) -> Result<String> { ... }
    fn as_literal_bool(&self) -> Result<bool> { ... }
    fn as_path(&self) -> Result<&Path> { ... }
}

Required Methods§

Source

fn get_self(&self) -> &Expr

Provided Methods§

Source

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

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

Source

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

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

Source

fn as_literal_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§