Enum AstConstantValue
pub enum AstConstantValue {
Integer(AstConstantInteger),
Fp(AstConstantFp),
Pointer(AstType, AstAddressConstant),
String {
ascii: Vec<String>,
},
}Expand description
A constant value that was either parsed from a literal or was evaluated from a constant expression.
Variants§
Integer(AstConstantInteger)
A constant integer value.
Fp(AstConstantFp)
Pointer(AstType, AstAddressConstant)
A pointer address constant from evaluating a static storage pointer initializer. See AstAddressConstant for more examples.
static int *p = 0;
static char *str = "hello";String
A constant string value from evaluating a static storage character array initializer.
static char text[4] = "abcd";Implementations§
§impl AstConstantValue
impl AstConstantValue
pub fn get_ast_type(&self) -> AstType
pub fn get_ast_type(&self) -> AstType
Gets the AST type of the constant value.
pub fn is_pointer_address_constant(&self) -> bool
pub fn is_pointer_address_constant(&self) -> bool
Is the constant value a pointer address constant?
pub fn has_negative_value(&self) -> bool
pub fn has_negative_value(&self) -> bool
Is the constant value below zero? Always false for unsigned types.
Trait Implementations§
§impl Clone for AstConstantValue
impl Clone for AstConstantValue
§fn clone(&self) -> AstConstantValue
fn clone(&self) -> AstConstantValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for AstConstantValue
impl Debug for AstConstantValue
§impl Display for AstConstantValue
impl Display for AstConstantValue
§impl From<AstConstantValue> for AstStaticStorageInitializer
impl From<AstConstantValue> for AstStaticStorageInitializer
§fn from(value: AstConstantValue) -> Self
fn from(value: AstConstantValue) -> Self
Converts to this type from the input type.
§impl PartialEq for AstConstantValue
impl PartialEq for AstConstantValue
impl StructuralPartialEq for AstConstantValue
Auto Trait Implementations§
impl Freeze for AstConstantValue
impl RefUnwindSafe for AstConstantValue
impl Send for AstConstantValue
impl Sync for AstConstantValue
impl Unpin for AstConstantValue
impl UnwindSafe for AstConstantValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more