#[repr(C)]pub struct Byte(/* private fields */);Expand description
A Byte is a value representing data, useful for its ability to
be addressed and subsequently accessed by a ByteAddr. Suppose
you have some byte address in ba and you want to ensure that the lowest
bit of that word is not set:
let b : Byte = ba.load();
assert!(b.is_aligned_to(2) == true);Trait Implementations§
Source§impl Address for Byte
impl Address for Byte
Source§fn from_usize(val: usize) -> Byte
fn from_usize(val: usize) -> Byte
Constructor for a byte value from a raw usize.
let w = Byte::from_usize(0xff);Source§fn as_usize(&self) -> usize
fn as_usize(&self) -> usize
Deconstructor for a byte value into a raw usize value.
let w = Byte::from_usize(0xff);
assert!(w.as_usize() == 255);Source§fn verify(self) -> bool
fn verify(self) -> bool
All possible byte values are valid:
let w = Byte::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 Byte
impl Ord for Byte
Source§impl PartialOrd for Byte
impl PartialOrd for Byte
impl Copy for Byte
impl Eq for Byte
Auto Trait Implementations§
impl Freeze for Byte
impl RefUnwindSafe for Byte
impl Send for Byte
impl Sync for Byte
impl Unpin for Byte
impl UnwindSafe for Byte
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