pub enum Architecture {
X86,
X64,
Arm,
Arm64,
Unknown(u16),
}Expand description
CPU architecture for PE files.
§Examples
use xll_utils::Architecture;
let arch = Architecture::from_machine_type(0x8664);
assert_eq!(arch, Architecture::X64);
assert!(arch.is_x64());
assert_eq!(arch.to_string(), "x64");Variants§
Implementations§
Source§impl Architecture
impl Architecture
Sourcepub const fn from_machine_type(machine: u16) -> Self
pub const fn from_machine_type(machine: u16) -> Self
Create an Architecture from a PE machine type constant.
use xll_utils::Architecture;
assert_eq!(Architecture::from_machine_type(0x014c), Architecture::X86);
assert_eq!(Architecture::from_machine_type(0x8664), Architecture::X64);
assert_eq!(Architecture::from_machine_type(0xaa64), Architecture::Arm64);
assert_eq!(Architecture::from_machine_type(0x9999), Architecture::Unknown(0x9999));Sourcepub const fn as_image_file_machine(self) -> Option<u16>
pub const fn as_image_file_machine(self) -> Option<u16>
Return the PE machine type constant, if known.
use xll_utils::Architecture;
assert_eq!(Architecture::X64.as_image_file_machine(), Some(0x8664));
assert_eq!(Architecture::Unknown(0x1234).as_image_file_machine(), None);pub const fn is_x86(self) -> bool
pub const fn is_x64(self) -> bool
pub const fn is_arm(self) -> bool
Trait Implementations§
Source§impl Clone for Architecture
impl Clone for Architecture
Source§fn clone(&self) -> Architecture
fn clone(&self) -> Architecture
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 moreSource§impl Debug for Architecture
impl Debug for Architecture
Source§impl Display for Architecture
impl Display for Architecture
Source§impl Hash for Architecture
impl Hash for Architecture
Source§impl PartialEq for Architecture
impl PartialEq for Architecture
impl Copy for Architecture
impl Eq for Architecture
impl StructuralPartialEq for Architecture
Auto Trait Implementations§
impl Freeze for Architecture
impl RefUnwindSafe for Architecture
impl Send for Architecture
impl Sync for Architecture
impl Unpin for Architecture
impl UnsafeUnpin for Architecture
impl UnwindSafe for Architecture
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