#[repr(C)]pub struct Word(/* private fields */);Expand description
A Word is a value representing data, useful for its ability to
be addressed and subsequently accessed by a WordAddr. Suppose
you have some word address in wa and you want to ensure that the lowest
bit of that word is set:
let w : Word = wa.load();
assert!(w.is_aligned_to(2) == false);Trait Implementations§
Source§impl Address for Word
impl Address for Word
Source§fn from_usize(val: usize) -> Word
fn from_usize(val: usize) -> Word
Constructor for a word value from a raw usize.
let w = Word::from_usize(0xff);Source§fn as_usize(&self) -> usize
fn as_usize(&self) -> usize
Deconstructor for a word value into a raw usize value.
let w = Word::from_usize(0xff);
assert!(w.as_usize() == 255);Source§fn verify(self) -> bool
fn verify(self) -> bool
All possible word values are valid:
let w = Word::from_usize(0xff);
assert!(w.verify());Source§fn offset<T, A: Address>(&self, offset: usize) -> A
fn offset<T, A: Address>(&self, offset: usize) -> A
Offset this
&self address some number of instances of type T, producing an address of
type A. Read moreSource§fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
Is the value of this address equivalent to the (universal) null value? Read more
Source§fn align_up<A: Address>(&self, align: usize) -> A
fn align_up<A: Address>(&self, align: usize) -> A
Align this pointer up (increasing value) to the nearest address with a value
aligned to
align bytes. For example the following properties hold: Read moreSource§fn gte<A: Address>(&self, addr: A) -> bool
fn gte<A: Address>(&self, addr: A) -> bool
Is the value of this address greater than or equal to the value of the given address? Read more
Source§fn greater<A: Address>(&self, addr: A) -> bool
fn greater<A: Address>(&self, addr: A) -> bool
Is the value of this address greater than the value of the given address? Read more
Source§fn lte<A: Address>(&self, addr: A) -> bool
fn lte<A: Address>(&self, addr: A) -> bool
Is the value of this address less than or equal to the value of the given address? Read more
Source§fn less<A: Address>(&self, addr: A) -> bool
fn less<A: Address>(&self, addr: A) -> bool
Is the value of this address less than the value of the given address? Read more
Source§fn is_aligned_to(&self, align: usize) -> bool
fn is_aligned_to(&self, align: usize) -> bool
Is the value of this address exactly aligned to the given alignment? Read more
Source§fn from_ptr<T>(ptr: *const T) -> Self
fn from_ptr<T>(ptr: *const T) -> Self
Construct an address from an immutable constant Rust pointer type. Read more
Source§fn to_ptr<T>(&self) -> *const T
fn to_ptr<T>(&self) -> *const T
Deconstruct an address into an immutable constant Rust pointer type. Read more
Source§fn to_ptr_mut<T>(&self) -> *mut T
fn to_ptr_mut<T>(&self) -> *mut T
Construct an address from a mutable constant Rust pointer type. Read more
Source§impl Ord for Word
impl Ord for Word
Source§impl PartialOrd for Word
impl PartialOrd for Word
impl Copy for Word
impl Eq for Word
Auto Trait Implementations§
impl Freeze for Word
impl RefUnwindSafe for Word
impl Send for Word
impl Sync for Word
impl Unpin for Word
impl UnwindSafe for Word
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