#[non_exhaustive]pub enum DecodeErrorKind {
Show 15 variants
UnexpectedEnd,
BadMagic,
UnsupportedVersion(u32),
ReservedFlags(u32),
SectionOutOfOrder {
expected: u32,
found: u32,
},
SectionLength(u32),
TrailingBytes,
LimitExceeded(Limit),
InvalidUtf8,
InvalidTag {
what: &'static str,
tag: u8,
},
InvalidChar(u32),
ConstForwardRef {
index: u32,
child: u32,
},
HookOrder,
DebugCount {
expected: u32,
found: u32,
},
Inst(InstError),
}Expand description
What is wrong with the input; see DecodeError.
§Examples
use bytecode_lang::{decode, DecodeErrorKind};
assert_eq!(decode(b"LS").unwrap_err().kind(), &DecodeErrorKind::UnexpectedEnd);
assert_eq!(decode(b"MZ\0\0\x01\0\0\0\0\0\0\0").unwrap_err().kind(), &DecodeErrorKind::BadMagic);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UnexpectedEnd
The input ends before a value it promises.
BadMagic
The first four bytes are not LSB\0.
UnsupportedVersion(u32)
The format version is not one this decoder implements.
ReservedFlags(u32)
The header’s reserved flags are not zero.
SectionOutOfOrder
A section id is not the next one in the fixed order.
SectionLength(u32)
A section’s contents do not fill exactly its declared length.
TrailingBytes
Bytes follow the last section.
LimitExceeded(Limit)
A budget was exceeded.
InvalidUtf8
A string is not valid UTF-8.
InvalidTag
A tag byte names nothing (what says which kind of tag).
Fields
InvalidChar(u32)
A char constant is not a Unicode scalar value.
ConstForwardRef
An aggregate constant refers to itself or a later constant.
HookOrder
Hook bindings are not in strictly increasing hook order.
DebugCount
The debug section’s function count differs from the function section’s.
Inst(InstError)
An instruction is malformed.
Trait Implementations§
Source§impl Clone for DecodeErrorKind
impl Clone for DecodeErrorKind
impl Copy for DecodeErrorKind
Source§impl Debug for DecodeErrorKind
impl Debug for DecodeErrorKind
Source§impl Display for DecodeErrorKind
impl Display for DecodeErrorKind
impl Eq for DecodeErrorKind
Source§impl PartialEq for DecodeErrorKind
impl PartialEq for DecodeErrorKind
impl StructuralPartialEq for DecodeErrorKind
Auto Trait Implementations§
impl Freeze for DecodeErrorKind
impl RefUnwindSafe for DecodeErrorKind
impl Send for DecodeErrorKind
impl Sync for DecodeErrorKind
impl Unpin for DecodeErrorKind
impl UnsafeUnpin for DecodeErrorKind
impl UnwindSafe for DecodeErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more