Skip to main content

HaoError

Enum HaoError 

Source
pub enum HaoError {
Show 27 variants IoError(Error), BadPeFormat, PeError(PewterError), NotDotNetBinary, BadImageFormat(&'static str), BadRva(u32), NotEnoughDataLeft(usize), InvalidColumnSize(i32), InvalidCodedToken(u32, &'static str), InvalidCodedTokenOffset(u32, &'static str), InvalidStreamIndex(&'static str, usize), InvalidUTF8String(usize, Vec<u8>), InvalidSignatureCallingConvention(u8), InvalidSignatureElementType(u8, usize), InvalidSignature(&'static str, usize), InvalidMethodBody(&'static str, usize), InvalidOpCode(u16, usize), InvalidToken(u32), InvalidCustomAttribute(String), ValueTooLarge(&'static str), WriteError(String), Import(String), NotFound(String), InvalidSignatureForEntry(&'static str), RecursionLimitReached, InvalidEntryReference(&'static str, usize), Unknown,
}
Expand description

Everything that can go wrong reading, editing or writing a module.

Loading is strict, so most variants describe a malformed image: which part of the file was bad and, where known, where.

Variants§

§

IoError(Error)

Reading or writing the file on disk failed, in Module::from_path or Module::write_to_path.

§

BadPeFormat

The bytes are not a valid PE image, or its optional header is missing.

§

PeError(PewterError)

The PE image could not be re-parsed or written back while writing a module.

§

NotDotNetBinary

The PE image has no CLI header, so it is native code rather than a .NET assembly.

§

BadImageFormat(&'static str)

The CLI header or metadata is malformed; the message says what was wrong.

§

BadRva(u32)

A relative virtual address points outside every section of the image.

§

NotEnoughDataLeft(usize)

A read ran past the end of its buffer; holds how many bytes were missing.

§

InvalidColumnSize(i32)

A metadata table column has an impossible size. Currently never returned.

§

InvalidCodedToken(u32, &'static str)

A coded index (e.g. TypeDefOrRef) has a tag that names no table; holds the raw value and the coded index kind.

§

InvalidCodedTokenOffset(u32, &'static str)

A coded index points past the end of its table. Currently never returned.

§

InvalidStreamIndex(&'static str, usize)

An offset into a metadata heap (#Strings, #Blob, #GUID, #US) is out of range.

§

InvalidUTF8String(usize, Vec<u8>)

A #Strings heap entry is not valid UTF-8; holds its offset and raw bytes.

§

InvalidSignatureCallingConvention(u8)

A signature starts with a calling convention byte hao does not recognise.

§

InvalidSignatureElementType(u8, usize)

A signature contains an unknown or misplaced ELEMENT_TYPE_* byte.

§

InvalidSignature(&'static str, usize)

A signature blob is malformed in some other way (truncated, a null token, …).

§

InvalidMethodBody(&'static str, usize)

A method body header, exception clause or operand is malformed.

§

InvalidOpCode(u16, usize)

The IL stream contains a byte sequence that is not an opcode.

§

InvalidToken(u32)

A metadata token in IL or a signature names a table it can’t, or a row that doesn’t exist.

§

InvalidCustomAttribute(String)

A custom attribute blob could not be decoded or encoded.

§

ValueTooLarge(&'static str)

A value is too big for its encoding, e.g. an integer over the compressed-integer limit.

§

WriteError(String)

A module could not be written: e.g. a branch to a missing label, or an entry that belongs to another module.

§

Import(String)

Something couldn’t be imported into a module (a type, method or field from another module, say).

§

NotFound(String)

A lookup found nothing: a type, member or assembly.

§

InvalidSignatureForEntry(&'static str)

A signature is the wrong kind for its entry. Currently never returned.

§

RecursionLimitReached

A signature nests types too deeply (more than 64 levels), which usually means it is malformed or cyclic.

§

InvalidEntryReference(&'static str, usize)

A table row refers to a row of another table that doesn’t exist; holds the table name and index.

§

Unknown

Unspecified failure. Currently never returned.

Trait Implementations§

Source§

impl Debug for HaoError

Source§

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

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

impl Display for HaoError

Source§

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

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

impl Error for HaoError

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

Replaced by Error::source.
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

Auto Trait Implementations§

§

impl !RefUnwindSafe for HaoError

§

impl !UnwindSafe for HaoError

§

impl Forget for HaoError

§

impl Freeze for HaoError
where *const () is !null: Freeze, PhantomData<ErrorData<CustomOwner>>: Freeze, &'static str: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for HaoError

§

impl Send for HaoError
where Repr: Send, &'static str: Send, RawVecInner: Send,

§

impl Sync for HaoError
where Repr: Sync, RawVecInner: Sync,

§

impl Unpin for HaoError
where *const () is !null: Unpin, &'static SimpleMessage: Unpin, *const Custom is !null: Unpin, &'static str: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for HaoError
where *const () is !null: UnsafeUnpin, PhantomData<ErrorData<CustomOwner>>: UnsafeUnpin, &'static str: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.