Enum binrw::Error [−][src]
The error type used by BinRead.
Variants (Non-exhaustive)
An expected magic number was not found.
Fields of BadMagic
An assertion failed.
This variant is used for assert directives which use a string
literal instead of an error object. Assertions that use error objects
are represented by the Custom variant.
Fields of AssertFail
Io(Error)An error occurred in the underlying reader while reading or seeking to data.
A user-generated error.
This variant is used for assert directives which use an error object
instead of a string literal. Assertions that use string literals are
represented by the AssertFail variant.
Fields of Custom
pos: u64The byte position of the start of the field or object that raised an error.
err: Box<dyn CustomError>The original error.
None of the variants of an enum could successfully be parsed from the data in the reader.
This variant is used when the return_unexpected_error directive is
set on an enum.
Fields of NoVariantMatch
pos: u64The byte position of the unparsable data in the reader.
None of the variants of an enum could successfully be parsed from the data in the reader.
This variant is used when the return_all_errors directive is
set on an enum (which is the default).
Fields of EnumErrors
pos: u64The byte position of the unparsable data in the reader.
variant_errors: Vec<(&'static str, Error)>The original errors which occurred when trying to parse each variant.
The first field of the tuple is the name of the variant, and the second field is the error that occurred when parsing that variant.
Implementations
impl Error[src]
pub fn custom_err<T: Any>(&self) -> Option<&T>[src]
Returns a reference to the boxed error object if this Error is a
custom error of type T, or None if it isn’t.
Trait Implementations
impl Debug for Error[src]
impl Display for Error[src]
impl Error for Error[src]
pub fn source(&self) -> Option<&(dyn Error + 'static)>1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>[src]
pub fn description(&self) -> &str1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>1.0.0[src]
impl From<Error> for Error[src]
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ[src]
impl<T> CustomError for T where
T: 'static + Any + Display + Debug + Send + Sync, [src]
T: 'static + Any + Display + Debug + Send + Sync,
pub fn as_any(&Self) -> &(dyn Any + 'static + Send + Sync)[src]
pub fn as_box_any(
Box<T, Global>
) -> Box<dyn Any + 'static + Send + Sync, Global>ⓘ[src]
Box<T, Global>
) -> Box<dyn Any + 'static + Send + Sync, Global>ⓘ
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,