Enum AstAddressConstant
pub enum AstAddressConstant {
NullPointer,
CastExpression(u64),
AddressOfObject {
object: String,
byte_offset: i32,
object_is_string_literal: bool,
},
AddressOfFunction(String),
}Expand description
An address constant is a null pointer, a pointer to an object of static storage duration, or a pointer to a function designator. A string literal has static storage duration so its address can be used as an address constant.
Variants§
NullPointer
Null pointer constant. int *p = 0;.
CastExpression(u64)
Initialize a pointer by casting from an integer value. int *p = (int *)123;.
AddressOfObject
Initialize a pointer with the address of an object of static storage duration.
static int a = 1;
static int *p = &a;
static int arr[4] = {1, 2, 3, 4};
static int *p = &arr[2];
static int *p = arr + 2;
static char *ptr = "Hello";AddressOfFunction(String)
Initialize a function pointer with the address of a function.
int get(void) { return 1; }
static int (*fn)(void) = &get; // or `get` without `&`Trait Implementations§
§impl Clone for AstAddressConstant
impl Clone for AstAddressConstant
§fn clone(&self) -> AstAddressConstant
fn clone(&self) -> AstAddressConstant
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 AstAddressConstant
impl Debug for AstAddressConstant
§impl PartialEq for AstAddressConstant
impl PartialEq for AstAddressConstant
impl StructuralPartialEq for AstAddressConstant
Auto Trait Implementations§
impl Freeze for AstAddressConstant
impl RefUnwindSafe for AstAddressConstant
impl Send for AstAddressConstant
impl Sync for AstAddressConstant
impl Unpin for AstAddressConstant
impl UnwindSafe for AstAddressConstant
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