pub struct MemorySizeInfo { /* private fields */ }
Expand description

MemorySize information

Implementations§

source§

impl MemorySizeInfo

source

pub const fn memory_size(&self) -> MemorySize

Gets the MemorySize value

Examples
use iced_x86::*;
let info = MemorySize::Packed256_UInt16.info();
assert_eq!(info.memory_size(), MemorySize::Packed256_UInt16);
source

pub const fn size(&self) -> usize

Gets the size in bytes of the memory location or 0 if it’s not accessed or unknown

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert_eq!(info.size(), 4);
let info = MemorySize::Packed256_UInt16.info();
assert_eq!(info.size(), 32);
let info = MemorySize::Broadcast512_UInt64.info();
assert_eq!(info.size(), 8);
source

pub const fn element_size(&self) -> usize

Gets the size in bytes of the packed element. If it’s not a packed data type, it’s equal to size().

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert_eq!(info.element_size(), 4);
let info = MemorySize::Packed256_UInt16.info();
assert_eq!(info.element_size(), 2);
let info = MemorySize::Broadcast512_UInt64.info();
assert_eq!(info.element_size(), 8);
source

pub const fn element_type(&self) -> MemorySize

Gets the element type if it’s packed data or the type itself if it’s not packed data

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert_eq!(info.element_type(), MemorySize::UInt32);
let info = MemorySize::Packed256_UInt16.info();
assert_eq!(info.element_type(), MemorySize::UInt16);
let info = MemorySize::Broadcast512_UInt64.info();
assert_eq!(info.element_type(), MemorySize::UInt64);
source

pub fn element_type_info(&self) -> &'static Self

Gets the element type if it’s packed data or the type itself if it’s not packed data

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info().element_type_info();
assert_eq!(info.memory_size(), MemorySize::UInt32);
let info = MemorySize::Packed256_UInt16.info().element_type_info();
assert_eq!(info.memory_size(), MemorySize::UInt16);
let info = MemorySize::Broadcast512_UInt64.info().element_type_info();
assert_eq!(info.memory_size(), MemorySize::UInt64);
source

pub const fn is_signed(&self) -> bool

true if it’s signed data (signed integer or a floating point value)

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert!(!info.is_signed());
let info = MemorySize::Int32.info();
assert!(info.is_signed());
let info = MemorySize::Float64.info();
assert!(info.is_signed());
source

pub const fn is_broadcast(&self) -> bool

true if it’s a broadcast memory type

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert!(!info.is_broadcast());
let info = MemorySize::Packed256_UInt16.info();
assert!(!info.is_broadcast());
let info = MemorySize::Broadcast512_UInt64.info();
assert!(info.is_broadcast());
source

pub const fn is_packed(&self) -> bool

true if this is a packed data type, eg. MemorySize::Packed128_Float32. See also element_count()

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert!(!info.is_packed());
let info = MemorySize::Packed256_UInt16.info();
assert!(info.is_packed());
let info = MemorySize::Broadcast512_UInt64.info();
assert!(!info.is_packed());
source

pub const fn element_count(&self) -> usize

Gets the number of elements in the packed data type or 1 if it’s not packed data (is_packed())

Examples
use iced_x86::*;
let info = MemorySize::UInt32.info();
assert_eq!(info.element_count(), 1);
let info = MemorySize::Packed256_UInt16.info();
assert_eq!(info.element_count(), 16);
let info = MemorySize::Broadcast512_UInt64.info();
assert_eq!(info.element_count(), 1);

Trait Implementations§

source§

impl Clone for MemorySizeInfo

source§

fn clone(&self) -> MemorySizeInfo

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 MemorySizeInfo

source§

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

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

impl Hash for MemorySizeInfo

source§

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

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 PartialEq for MemorySizeInfo

source§

fn eq(&self, other: &MemorySizeInfo) -> 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 Copy for MemorySizeInfo

source§

impl Eq for MemorySizeInfo

source§

impl StructuralEq for MemorySizeInfo

source§

impl StructuralPartialEq for MemorySizeInfo

Auto Trait Implementations§

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> ToOwned for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.