Enum clippy::consts::Constant [] [src]

pub enum Constant {
    ConstantStr(String, StrStyle),
    ConstantBinary(Rc<Vec<u8>>),
    ConstantByte(u8),
    ConstantChar(char),
    ConstantInt(u64, LitIntType),
    ConstantFloat(String, FloatWidth),
    ConstantBool(bool),
    ConstantVec(Vec<Constant>),
    ConstantRepeat(Box<Constant>, usize),
    ConstantTuple(Vec<Constant>),
}

a Lit_-like enum to fold constant Exprs into

Variants

ConstantStr

a String "abc"

ConstantBinary

a Binary String b"abc"

ConstantByte

a single byte b'a'

ConstantChar

a single char 'a'

ConstantInt

an integer

ConstantFloat

a float with given type

ConstantBool

true or false

ConstantVec

an array of constants

ConstantRepeat

also an array, but with only one constant, repeated N times

ConstantTuple

a tuple of constants

Methods

impl Constant

fn as_float(&self) -> Option<f64>

convert this constant to a f64, if possible

Trait Implementations

impl PartialEq for Constant

fn eq(&self, other: &Constant) -> bool

fn ne(&self, other: &Rhs) -> bool

impl PartialOrd for Constant

fn partial_cmp(&self, other: &Constant) -> Option<Ordering>

fn lt(&self, other: &Rhs) -> bool

fn le(&self, other: &Rhs) -> bool

fn gt(&self, other: &Rhs) -> bool

fn ge(&self, other: &Rhs) -> bool

Derived Implementations

impl Clone for Constant

fn clone(&self) -> Constant

fn clone_from(&mut self, source: &Self)

impl Debug for Constant

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Eq for Constant