Enum pelite::Error [−][src]
pub enum Error { Null, OOB, ZeroFill, Unmapped, Misalign, BadMagic, Insanity, Corrupt, Overflow, CStr, }
Errors while parsing the PE binary.
Variants
Null
Null address.
OOB
Index was out of bounds.
ZeroFill
Sections can be shorter than stored on disk, the remaining bytes will default to zeroes when loaded by the system. Since these zeroes would just be a waste of space, they are not present in the binaries on disk.
This error happens when attempting to get a reference to such zero filled data when working with PeFile
contents.
Unmapped
Data is not mapped.
Misalign
Address is misaligned.
BadMagic
Magic number does not match the expected value.
Insanity
Sanity check failed.
Some value was so far outside its typical range, while not technically incorrect, probably indicating something went wrong.
Corrupt
Data corruption.
Structured data was found which simply isn't valid.
Catch all for errors which don't fall under other errors.
Overflow
Address calculation overflow error.
CStr
No nul byte found when reading a C string.
Methods
impl Error
[src]
impl Error
pub fn is_null(self) -> bool
[src]
pub fn is_null(self) -> bool
Returns if the error variant is Null.
Useful in match guards where Null
should be handled as a non-error case.
fn with_default(result: pelite::Result<i32>) -> pelite::Result<i32> { let i = match result { Ok(i) => i, // Avoids a more verbose comparison with pelite::Error::Null Err(err) if err.is_null() => 0, Err(err) => return Err(err), }; Ok(i) } assert_eq!(with_default(Err(pelite::Error::Null)), Ok(0));
Trait Implementations
impl Copy for Error
[src]
impl Copy for Error
impl Clone for Error
[src]
impl Clone for Error
fn clone(&self) -> Error
[src]
fn clone(&self) -> Error
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Error
[src]
impl Debug for Error
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Error
[src]
impl Eq for Error
impl PartialEq for Error
[src]
impl PartialEq for Error
fn eq(&self, other: &Error) -> bool
[src]
fn eq(&self, other: &Error) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Hash for Error
[src]
impl Hash for Error
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Error
[src]
impl Display for Error
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Error for Error
[src]
impl Error for Error
fn description(&self) -> &str
[src]
fn description(&self) -> &str
This method is soft-deprecated. Read more
fn cause(&self) -> Option<&Error>
1.0.0[src]
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more
impl From<Error> for FindError
[src]
impl From<Error> for FindError