Struct MemoryRegion

Source
pub struct MemoryRegion<D: Clone> { /* private fields */ }
Expand description

Describes a region in memory.

The MemoryRegion.upper_bound is inclusive.

Biggest possible memory address: AddressType::MAX.

Implementations§

Source§

impl<D: Clone> MemoryRegion<D>

Source

pub fn address_in_region(&self, address: AddressType) -> bool

Returns true if a address is inside of the MemoryRegion.

Source

pub fn address_comes_after(&self, address: AddressType) -> bool

Returns true if a address comes after the upper bound of the MemoryRegion.

Source

pub fn overlaps(&self, other: &MemoryRegion<D>) -> bool

Returns true if the given MemoryRegion overlaps with another MemoryRegion.

Source

pub fn comes_after(&self, other: &MemoryRegion<D>) -> bool

Returns true if the given MemoryRegions lower bound is bigger than the other MemoryRegions upper bound.

Source

pub fn starts_at_zero(&self) -> bool

Returns true if the MemoryRegion starts at the beginning of memory.

Source

pub fn is_adjacent_to(&self, other: &MemoryRegion<D>) -> bool

Returns true if the given MemoryRegion is directly next to another MemoryRegion.

Source

pub fn lower_bound(&self) -> AddressType

Lower bound of the MemoryRegion.

Source

pub fn upper_bound(&self) -> AddressType

Upper bound of the MemoryRegion.

Source

pub fn description(&self) -> D

Description of the MemoryRegion.

Source

pub fn to_range(&self) -> RangeInclusive<AddressType>

Returns the MemoryRegion as a range.

Trait Implementations§

Source§

impl<D: Debug + Clone> Debug for MemoryRegion<D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D: PartialEq + Clone> PartialEq for MemoryRegion<D>

Source§

fn eq(&self, other: &MemoryRegion<D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<D: Eq + Clone> Eq for MemoryRegion<D>

Source§

impl<D: Clone> StructuralPartialEq for MemoryRegion<D>

Auto Trait Implementations§

§

impl<D> Freeze for MemoryRegion<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for MemoryRegion<D>
where D: RefUnwindSafe,

§

impl<D> Send for MemoryRegion<D>
where D: Send,

§

impl<D> Sync for MemoryRegion<D>
where D: Sync,

§

impl<D> Unpin for MemoryRegion<D>
where D: Unpin,

§

impl<D> UnwindSafe for MemoryRegion<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.