Enum Error

Source
#[repr(C)]
pub enum Error {
Show 46 variants OK = 0, NOMEM = 1, ARCH = 2, HANDLE = 3, MODE = 4, VERSION = 5, OPT_INVALID = 6, ASM_EXPR_TOKEN = 128, ASM_DIRECTIVE_VALUE_RANGE = 129, ASM_DIRECTIVE_ID = 130, ASM_DIRECTIVE_TOKEN = 131, ASM_DIRECTIVE_STR = 132, ASM_DIRECTIVE_COMMA = 133, ASM_DIRECTIVE_RELOC_NAME = 134, ASM_DIRECTIVE_RELOC_TOKEN = 135, ASM_DIRECTIVE_FPOINT = 136, ASM_DIRECTIVE_UNKNOWN = 137, ASM_DIRECTIVE_EQU = 138, ASM_DIRECTIVE_INVALID = 139, ASM_VARIANT_INVALID = 140, ASM_EXPR_BRACKET = 141, ASM_SYMBOL_MODIFIER = 142, ASM_SYMBOL_REDEFINED = 143, ASM_SYMBOL_MISSING = 144, ASM_RPAREN = 145, ASM_STAT_TOKEN = 146, ASM_UNSUPPORTED = 147, ASM_MACRO_TOKEN = 148, ASM_MACRO_PAREN = 149, ASM_MACRO_EQU = 150, ASM_MACRO_ARGS = 151, ASM_MACRO_LEVELS_EXCEED = 152, ASM_MACRO_STR = 153, ASM_MACRO_INVALID = 154, ASM_ESC_BACKSLASH = 155, ASM_ESC_OCTAL = 156, ASM_ESC_SEQUENCE = 157, ASM_ESC_STR = 158, ASM_TOKEN_INVALID = 159, ASM_INSN_UNSUPPORTED = 160, ASM_FIXUP_INVALID = 161, ASM_LABEL_INVALID = 162, ASM_FRAGMENT_INVALID = 163, ASM_INVALIDOPERAND = 512, ASM_MISSINGFEATURE = 513, ASM_MNEMONICFAIL = 514,
}
Expand description

All type of errors encountered by Keystone API.

Variants§

§

OK = 0

No error: everything was fine.

§

NOMEM = 1

Out-Of-Memory error: ks_open(), ks_emulate().

§

ARCH = 2

Unsupported architecture: ks_open().

§

HANDLE = 3

Invalid handle.

§

MODE = 4

Invalid/unsupported mode: ks_open().

§

VERSION = 5

Unsupported version (bindings).

§

OPT_INVALID = 6

Unsupported option.

§

ASM_EXPR_TOKEN = 128

Unknown token in expression.

§

ASM_DIRECTIVE_VALUE_RANGE = 129

Literal value out of range for directive.

§

ASM_DIRECTIVE_ID = 130

Expected identifier in directive.

§

ASM_DIRECTIVE_TOKEN = 131

Unexpected token in directive.

§

ASM_DIRECTIVE_STR = 132

Expected string in directive.

§

ASM_DIRECTIVE_COMMA = 133

Expected comma in directive.

§

ASM_DIRECTIVE_RELOC_NAME = 134

Expected relocation name in directive.

§

ASM_DIRECTIVE_RELOC_TOKEN = 135

Unexpected token in .reloc directive.

§

ASM_DIRECTIVE_FPOINT = 136

Invalid floating point in directive.

§

ASM_DIRECTIVE_UNKNOWN = 137

Unknown directive.

§

ASM_DIRECTIVE_EQU = 138

Invalid equal directive.

§

ASM_DIRECTIVE_INVALID = 139

(Generic) invalid directive.

§

ASM_VARIANT_INVALID = 140

Invalid variant.

§

ASM_EXPR_BRACKET = 141

Brackets expression not supported on this target.

§

ASM_SYMBOL_MODIFIER = 142

Unexpected symbol modifier following ‘@’.

§

ASM_SYMBOL_REDEFINED = 143

Invalid symbol redefinition.

§

ASM_SYMBOL_MISSING = 144

Cannot find a symbol.

§

ASM_RPAREN = 145

Expected ‘)’ in parentheses expression.

§

ASM_STAT_TOKEN = 146

Unexpected token at start of statement.

§

ASM_UNSUPPORTED = 147

Unsupported token yet.

§

ASM_MACRO_TOKEN = 148

Unexpected token in macro instantiation.

§

ASM_MACRO_PAREN = 149

Unbalanced parentheses in macro argument.

§

ASM_MACRO_EQU = 150

Expected ‘=’ after formal parameter identifier.

§

ASM_MACRO_ARGS = 151

Too many positional arguments.

§

ASM_MACRO_LEVELS_EXCEED = 152

Macros cannot be nested more than 20 levels deep.

§

ASM_MACRO_STR = 153

Invalid macro string.

§

ASM_MACRO_INVALID = 154

Invalid macro (generic error).

§

ASM_ESC_BACKSLASH = 155

Unexpected backslash at end of escaped string.

§

ASM_ESC_OCTAL = 156

Invalid octal escape sequence (out of range).

§

ASM_ESC_SEQUENCE = 157

Invalid escape sequence (unrecognized character).

§

ASM_ESC_STR = 158

Broken escape string.

§

ASM_TOKEN_INVALID = 159

Invalid token.

§

ASM_INSN_UNSUPPORTED = 160

This instruction is unsupported in this mode.

§

ASM_FIXUP_INVALID = 161

Invalid fixup.

§

ASM_LABEL_INVALID = 162

Invalid label.

§

ASM_FRAGMENT_INVALID = 163

Invalid fragment.

§

ASM_INVALIDOPERAND = 512

Generic input assembly errors (invalid operand) - architecture specific.

§

ASM_MISSINGFEATURE = 513

Generic input assembly errors (missing feature) - architecture specific.

§

ASM_MNEMONICFAIL = 514

Generic input assembly errors (mnemonic fail) - architecture specific.

Implementations§

Source§

impl Error

Source

pub fn new(ks: KsHandle) -> Option<Self>

Returns the latest error recorded error, if any.

Source

pub fn strerror(self) -> String

Returns a description for a given Keystone error.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate 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

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

impl Display for Error

Source§

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

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

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for KeystoneError

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl Hash for Error

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

Source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. 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 PartialOrd for Error

Source§

fn partial_cmp(&self, other: &Error) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Error

Source§

impl Eq 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.