Struct driverkit::IOAddr

source ·
pub struct IOAddr(pub u64);
Expand description

A wrapper for an IO address (IOVA / DMA Address for devices)

Tuple Fields§

§0: u64

Implementations§

source§

impl IOAddr

source

pub fn as_u64(self) -> u64

Convert to u64

source

pub fn as_usize(self) -> usize

Convert to usize

source

pub const fn zero() -> IOAddr

IO Address zero.

source

pub fn is_zero(self) -> bool

Is zero?

source

pub fn split(&self) -> (u32, u32)

Split IOAddr into lower and higher 32-bits.

source

pub fn base_page_offset(self) -> u64

Offset within the 4 KiB page.

source

pub fn large_page_offset(self) -> u64

Offset within the 2 MiB page.

source

pub fn huge_page_offset(self) -> u64

Offset within the 1 GiB page.

source

pub fn align_down_to_base_page(self) -> IOAddr

Return address of nearest 4 KiB page (lower or equal than self).

source

pub fn align_down_to_large_page(self) -> IOAddr

Return address of nearest 2 MiB page (lower or equal than self).

source

pub fn align_down_to_huge_page(self) -> IOAddr

Return address of nearest 1 GiB page (lower or equal than self).

source

pub fn align_up_to_base_page(self) -> IOAddr

Return address of nearest 4 KiB page (higher or equal than self).

source

pub fn align_up_to_large_page(self) -> IOAddr

Return address of nearest 2 MiB page (higher or equal than self).

source

pub fn align_up_to_huge_page(self) -> IOAddr

Return address of nearest 1 GiB page (higher or equal than self).

source

pub fn is_base_page_aligned(self) -> bool

Is this address aligned to a 4 KiB page?

source

pub fn is_large_page_aligned(self) -> bool

Is this address aligned to a 2 MiB page?

source

pub fn is_huge_page_aligned(self) -> bool

Is this address aligned to a 1 GiB page?

source

pub fn is_aligned<U>(self, align: U) -> boolwhere U: Into<u64> + Copy,

Is this address aligned to align?

Note

align must be a power of two.

Trait Implementations§

source§

impl Add<IOAddr> for IOAddr

§

type Output = IOAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: IOAddr) -> <IOAddr as Add<IOAddr>>::Output

Performs the + operation. Read more
source§

impl Add<u64> for IOAddr

§

type Output = IOAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: u64) -> <IOAddr as Add<u64>>::Output

Performs the + operation. Read more
source§

impl Add<usize> for IOAddr

§

type Output = IOAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: usize) -> <IOAddr as Add<usize>>::Output

Performs the + operation. Read more
source§

impl AddAssign<IOAddr> for IOAddr

source§

fn add_assign(&mut self, other: IOAddr)

Performs the += operation. Read more
source§

impl AddAssign<u64> for IOAddr

source§

fn add_assign(&mut self, offset: u64)

Performs the += operation. Read more
source§

impl Binary for IOAddr

source§

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

Formats the value using the given formatter.
source§

impl BitAnd<IOAddr> for IOAddr

§

type Output = IOAddr

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: IOAddr) -> IOAddr

Performs the & operation. Read more
source§

impl BitAnd<u64> for IOAddr

§

type Output = u64

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: u64) -> <IOAddr as BitAnd<u64>>::Output

Performs the & operation. Read more
source§

impl BitOr<IOAddr> for IOAddr

§

type Output = IOAddr

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: IOAddr) -> <IOAddr as BitOr<IOAddr>>::Output

Performs the | operation. Read more
source§

impl BitOr<u64> for IOAddr

§

type Output = u64

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: u64) -> <IOAddr as BitOr<u64>>::Output

Performs the | operation. Read more
source§

impl Clone for IOAddr

source§

fn clone(&self) -> IOAddr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IOAddr

source§

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

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

impl Display for IOAddr

source§

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

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

impl From<i32> for IOAddr

source§

fn from(num: i32) -> IOAddr

Converts to this type from the input type.
source§

impl From<u64> for IOAddr

source§

fn from(num: u64) -> IOAddr

Converts to this type from the input type.
source§

impl From<usize> for IOAddr

source§

fn from(num: usize) -> IOAddr

Converts to this type from the input type.
source§

impl Hash for IOAddr

source§

fn hash<H>(&self, state: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<u64> for IOAddr

source§

fn into(self) -> u64

Converts this type into the (usually inferred) input type.
source§

impl Into<usize> for IOAddr

source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.
source§

impl LowerHex for IOAddr

source§

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

Formats the value using the given formatter.
source§

impl Octal for IOAddr

source§

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

Formats the value using the given formatter.
source§

impl Ord for IOAddr

source§

fn cmp(&self, other: &IOAddr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<IOAddr> for IOAddr

source§

fn eq(&self, other: &IOAddr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<IOAddr> for IOAddr

source§

fn partial_cmp(&self, other: &IOAddr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Pointer for IOAddr

source§

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

Formats the value using the given formatter.
source§

impl Rem<IOAddr> for IOAddr

§

type Output = IOAddr

The resulting type after applying the % operator.
source§

fn rem(self, rhs: IOAddr) -> <IOAddr as Rem<IOAddr>>::Output

Performs the % operation. Read more
source§

impl Rem<u64> for IOAddr

§

type Output = u64

The resulting type after applying the % operator.
source§

fn rem(self, rhs: u64) -> <IOAddr as Rem<u64>>::Output

Performs the % operation. Read more
source§

impl Rem<usize> for IOAddr

§

type Output = u64

The resulting type after applying the % operator.
source§

fn rem(self, rhs: usize) -> <IOAddr as Rem<usize>>::Output

Performs the % operation. Read more
source§

impl Shr<u64> for IOAddr

§

type Output = u64

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u64) -> <IOAddr as Shr<u64>>::Output

Performs the >> operation. Read more
source§

impl Step for IOAddr

source§

fn steps_between(start: &IOAddr, end: &IOAddr) -> Option<usize>

🔬This is a nightly-only experimental API. (step_trait)
Returns the number of successor steps required to get from start to end. Read more
source§

fn forward_checked(start: IOAddr, count: usize) -> Option<IOAddr>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

fn backward_checked(start: IOAddr, count: usize) -> Option<IOAddr>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

fn forward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

unsafe fn forward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

fn backward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

unsafe fn backward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

impl Sub<IOAddr> for IOAddr

§

type Output = IOAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: IOAddr) -> <IOAddr as Sub<IOAddr>>::Output

Performs the - operation. Read more
source§

impl Sub<u64> for IOAddr

§

type Output = IOAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: u64) -> <IOAddr as Sub<u64>>::Output

Performs the - operation. Read more
source§

impl Sub<usize> for IOAddr

§

type Output = IOAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: usize) -> <IOAddr as Sub<usize>>::Output

Performs the - operation. Read more
source§

impl UpperHex for IOAddr

source§

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

Formats the value using the given formatter.
source§

impl Copy for IOAddr

source§

impl Eq for IOAddr

source§

impl StructuralEq for IOAddr

source§

impl StructuralPartialEq for IOAddr

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.