Enum Error

Source
#[repr(C)]
pub enum Error {
Show 22 variants OK = 0, NOMEM = 1, ARCH = 2, HANDLE = 3, MODE = 4, VERSION = 5, READ_UNMAPPED = 6, WRITE_UNMAPPED = 7, ETCH_UNMAPPED = 8, HOOK = 9, INSN_INVALID = 10, MAP = 11, WRITE_PROT = 12, READ_PROT = 13, FETCH_PROT = 14, ARG = 15, READ_UNALIGNED = 16, WRITE_UNALIGNED = 17, FETCH_UNALIGNED = 18, HOOK_EXIST = 19, RESOURCE = 20, EXCEPTION = 21,
}

Variants§

§

OK = 0

§

NOMEM = 1

§

ARCH = 2

§

HANDLE = 3

§

MODE = 4

§

VERSION = 5

§

READ_UNMAPPED = 6

§

WRITE_UNMAPPED = 7

§

ETCH_UNMAPPED = 8

§

HOOK = 9

§

INSN_INVALID = 10

§

MAP = 11

§

WRITE_PROT = 12

§

READ_PROT = 13

§

FETCH_PROT = 14

§

ARG = 15

§

READ_UNALIGNED = 16

§

WRITE_UNALIGNED = 17

§

FETCH_UNALIGNED = 18

§

HOOK_EXIST = 19

§

RESOURCE = 20

§

EXCEPTION = 21

Implementations§

Source§

impl Error

Source

pub fn msg(self) -> &'static str

Examples found in repository?
examples/test.rs (line 26)
5fn main() {
6    let (major, minor) = unicorn::unicorn_version();
7    println!("version : {}.{}", major, minor);
8    println!(
9        "Support for:\n\t x86: {}\n\t arm: {}\n\t mips: {}",
10        unicorn::arch_supported(unicorn::Arch::X86),
11        unicorn::arch_supported(unicorn::Arch::ARM),
12        unicorn::arch_supported(unicorn::Arch::MIPS)
13    );
14
15    let emu = CpuARM::new(unicorn::Mode::THUMB).expect("failed to create emulator");
16
17    let page_size = emu
18        .query(unicorn::Query::PAGE_SIZE)
19        .expect("failed to query page size");
20    println!("page size : {}", page_size);
21    let hardware_mode = emu
22        .query(unicorn::Query::MODE)
23        .expect("failed to query hardware mode");
24    println!("hardware mode : {}", hardware_mode);
25
26    println!("Sample error message : {}", unicorn::Error::HOOK.msg());
27
28    emu.mem_map(0x10000, 0x4000, unicorn::Protection::ALL)
29        .expect("failed to map first memory region");
30    emu.mem_map(0x20000, 0x4000, unicorn::Protection::ALL)
31        .expect("failed to map second memory region");
32    let regions = emu
33        .mem_regions()
34        .expect("failed to retrieve memory mappings");
35    println!("Regions : {}", regions.len());
36
37    for region in &regions {
38        println!("{:?}", region);
39    }
40}

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

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 Error

Source§

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

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

impl Display for Error

Source§

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

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

impl PartialEq for Error

Source§

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

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

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 Copy for Error

Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.