Struct MemoryRegionAddress
pub struct MemoryRegionAddress(pub u64);Expand description
Represents an offset inside a region.
Tuple Fields§
§0: u64Trait Implementations§
§impl Address for MemoryRegionAddress
impl Address for MemoryRegionAddress
§fn new(value: u64) -> MemoryRegionAddress
fn new(value: u64) -> MemoryRegionAddress
Creates an address from a raw address value.
§fn checked_offset_from(&self, base: MemoryRegionAddress) -> Option<u64>
fn checked_offset_from(&self, base: MemoryRegionAddress) -> Option<u64>
Computes the offset from this address to the given base address. Read more
§fn checked_add(&self, other: u64) -> Option<MemoryRegionAddress>
fn checked_add(&self, other: u64) -> Option<MemoryRegionAddress>
Computes
self + other, returning None if overflow occurred.§fn overflowing_add(&self, other: u64) -> (MemoryRegionAddress, bool)
fn overflowing_add(&self, other: u64) -> (MemoryRegionAddress, bool)
Computes
self + other. Read more§fn unchecked_add(&self, offset: u64) -> MemoryRegionAddress
fn unchecked_add(&self, offset: u64) -> MemoryRegionAddress
Computes
self + offset. Read more§fn checked_sub(&self, other: u64) -> Option<MemoryRegionAddress>
fn checked_sub(&self, other: u64) -> Option<MemoryRegionAddress>
Subtracts two addresses, checking for underflow. If underflow happens,
None is returned.§fn overflowing_sub(&self, other: u64) -> (MemoryRegionAddress, bool)
fn overflowing_sub(&self, other: u64) -> (MemoryRegionAddress, bool)
Computes
self - other. Read more§fn unchecked_sub(&self, other: u64) -> MemoryRegionAddress
fn unchecked_sub(&self, other: u64) -> MemoryRegionAddress
Computes
self - other. Read more§fn mask(&self, mask: Self::V) -> Self::V
fn mask(&self, mask: Self::V) -> Self::V
Returns the bitwise and of the address with the given mask.
§fn unchecked_offset_from(&self, base: Self) -> Self::V
fn unchecked_offset_from(&self, base: Self) -> Self::V
Computes the offset from this address to the given base address. Read more
§fn checked_align_up(&self, power_of_two: Self::V) -> Option<Self>
fn checked_align_up(&self, power_of_two: Self::V) -> Option<Self>
Returns self, aligned to the given power of two.
§fn unchecked_align_up(&self, power_of_two: Self::V) -> Self
fn unchecked_align_up(&self, power_of_two: Self::V) -> Self
Returns self, aligned to the given power of two.
Only use this when the result is guaranteed not to overflow.
§impl AddressValue for MemoryRegionAddress
impl AddressValue for MemoryRegionAddress
§impl BitAnd<u64> for MemoryRegionAddress
impl BitAnd<u64> for MemoryRegionAddress
§type Output = MemoryRegionAddress
type Output = MemoryRegionAddress
The resulting type after applying the
& operator.§fn bitand(self, other: u64) -> MemoryRegionAddress
fn bitand(self, other: u64) -> MemoryRegionAddress
Performs the
& operation. Read more§impl BitOr<u64> for MemoryRegionAddress
impl BitOr<u64> for MemoryRegionAddress
§type Output = MemoryRegionAddress
type Output = MemoryRegionAddress
The resulting type after applying the
| operator.§fn bitor(self, other: u64) -> MemoryRegionAddress
fn bitor(self, other: u64) -> MemoryRegionAddress
Performs the
| operation. Read more§impl Clone for MemoryRegionAddress
impl Clone for MemoryRegionAddress
§fn clone(&self) -> MemoryRegionAddress
fn clone(&self) -> MemoryRegionAddress
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 MemoryRegionAddress
impl Debug for MemoryRegionAddress
§impl Default for MemoryRegionAddress
impl Default for MemoryRegionAddress
§fn default() -> MemoryRegionAddress
fn default() -> MemoryRegionAddress
Returns the “default value” for a type. Read more
§impl Ord for MemoryRegionAddress
impl Ord for MemoryRegionAddress
§fn cmp(&self, other: &MemoryRegionAddress) -> Ordering
fn cmp(&self, other: &MemoryRegionAddress) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
§impl PartialEq for MemoryRegionAddress
impl PartialEq for MemoryRegionAddress
§impl PartialOrd for MemoryRegionAddress
impl PartialOrd for MemoryRegionAddress
impl Copy for MemoryRegionAddress
impl Eq for MemoryRegionAddress
impl StructuralPartialEq for MemoryRegionAddress
Auto Trait Implementations§
impl Freeze for MemoryRegionAddress
impl RefUnwindSafe for MemoryRegionAddress
impl Send for MemoryRegionAddress
impl Sync for MemoryRegionAddress
impl Unpin for MemoryRegionAddress
impl UnwindSafe for MemoryRegionAddress
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
§impl<R> Bytes<MemoryRegionAddress> for Rwhere
R: GuestMemoryRegionBytes,
impl<R> Bytes<MemoryRegionAddress> for Rwhere
R: GuestMemoryRegionBytes,
§fn write(&self, buf: &[u8], addr: MemoryRegionAddress) -> Result<usize, Error>
fn write(&self, buf: &[u8], addr: MemoryRegionAddress) -> Result<usize, Error>
§Examples
- Write a slice at guest address 0x1200.
let res = gm
.write(&[1, 2, 3, 4, 5], GuestAddress(0x1200))
.expect("Could not write to guest memory");
assert_eq!(5, res);§fn read(
&self,
buf: &mut [u8],
addr: MemoryRegionAddress,
) -> Result<usize, Error>
fn read( &self, buf: &mut [u8], addr: MemoryRegionAddress, ) -> Result<usize, Error>
§Examples
- Read a slice of length 16 at guestaddress 0x1200.
let buf = &mut [0u8; 16];
let res = gm
.read(buf, GuestAddress(0x1200))
.expect("Could not read from guest memory");
assert_eq!(16, res);§fn write_slice(
&self,
buf: &[u8],
addr: MemoryRegionAddress,
) -> Result<(), Error>
fn write_slice( &self, buf: &[u8], addr: MemoryRegionAddress, ) -> Result<(), Error>
Writes the entire content of a slice into the container at
addr. Read more§fn read_slice(
&self,
buf: &mut [u8],
addr: MemoryRegionAddress,
) -> Result<(), Error>
fn read_slice( &self, buf: &mut [u8], addr: MemoryRegionAddress, ) -> Result<(), Error>
Reads data from the container at
addr to fill an entire slice. Read more§fn read_volatile_from<F>(
&self,
addr: MemoryRegionAddress,
src: &mut F,
count: usize,
) -> Result<usize, Error>where
F: ReadVolatile,
fn read_volatile_from<F>(
&self,
addr: MemoryRegionAddress,
src: &mut F,
count: usize,
) -> Result<usize, Error>where
F: ReadVolatile,
Reads up to
count bytes from src and writes them into the container at addr.
Unlike VolatileRead::read_volatile, this function retries on EINTR being returned from
the underlying I/O read operation. Read more§fn read_exact_volatile_from<F>(
&self,
addr: MemoryRegionAddress,
src: &mut F,
count: usize,
) -> Result<(), Error>where
F: ReadVolatile,
fn read_exact_volatile_from<F>(
&self,
addr: MemoryRegionAddress,
src: &mut F,
count: usize,
) -> Result<(), Error>where
F: ReadVolatile,
§fn write_volatile_to<F>(
&self,
addr: MemoryRegionAddress,
dst: &mut F,
count: usize,
) -> Result<usize, Error>where
F: WriteVolatile,
fn write_volatile_to<F>(
&self,
addr: MemoryRegionAddress,
dst: &mut F,
count: usize,
) -> Result<usize, Error>where
F: WriteVolatile,
Reads up to
count bytes from the container at addr and writes them into dst.
Unlike VolatileWrite::write_volatile, this function retries on EINTR being returned by
the underlying I/O write operation. Read more§fn write_all_volatile_to<F>(
&self,
addr: MemoryRegionAddress,
dst: &mut F,
count: usize,
) -> Result<(), Error>where
F: WriteVolatile,
fn write_all_volatile_to<F>(
&self,
addr: MemoryRegionAddress,
dst: &mut F,
count: usize,
) -> Result<(), Error>where
F: WriteVolatile,
§fn store<T>(
&self,
val: T,
addr: MemoryRegionAddress,
order: Ordering,
) -> Result<(), Error>where
T: AtomicAccess,
fn store<T>(
&self,
val: T,
addr: MemoryRegionAddress,
order: Ordering,
) -> Result<(), Error>where
T: AtomicAccess,
Atomically store a value at the specified address.
§fn load<T>(
&self,
addr: MemoryRegionAddress,
order: Ordering,
) -> Result<T, Error>where
T: AtomicAccess,
fn load<T>(
&self,
addr: MemoryRegionAddress,
order: Ordering,
) -> Result<T, Error>where
T: AtomicAccess,
Atomically load a value from the specified address.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.