pub struct Address(/* private fields */);Expand description
A 64-bit memory address, parsed from hex literals (e.g., 0x1000).
Used for memory region sizes, physical addresses, and virtual addresses.
Always 64-bit to match seL4 Microkit targets. When the common data layer
is implemented, add From<Address> for usize (Rust FFI) and expose as
uintptr_t (C FFI).
use fic::ast::Address;
let addr = Address::new(0x1000);
assert_eq!(addr.value(), 0x1000);
assert_eq!(format!("{addr}"), "0x1000");Implementations§
Source§impl Address
impl Address
Sourcepub fn is_aligned(&self, page_size: PageSize) -> bool
pub fn is_aligned(&self, page_size: PageSize) -> bool
Check if the address is aligned to the given page size.
use fic::ast::{Address, PageSize};
let aligned = Address::new(0x1000);
assert!(aligned.is_aligned(PageSize::Small));
let unaligned = Address::new(0x1001);
assert!(!unaligned.is_aligned(PageSize::Small));Sourcepub fn to_hex_grouped(&self) -> String
pub fn to_hex_grouped(&self) -> String
Format as hex with underscore grouping every 3 digits: 0x3_000_000.
Trait Implementations§
impl Copy for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnsafeUnpin for Address
impl UnwindSafe for Address
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.