pub enum ContractFileParseError {
Show 14 variants
FileTooLarge {
file_size: usize,
},
NoHeader,
WrongMagicBytes,
MetadataOutOfRange {
offset: u32,
size: u16,
file_size: u32,
},
MetadataDecoding,
FileTooSmall {
num_methods: u16,
read_only_section_size: u32,
file_size: u32,
},
MethodOutOfRange {
offset: u32,
code_section_offset: u32,
file_size: u32,
},
HostCallFnOutOfRange {
offset: u32,
code_section_offset: u32,
file_size: u32,
},
InvalidHostCallFnPattern {
first: Instruction,
second: Instruction,
},
InvalidReadOnlySizes {
file_size: u32,
memory_size: u32,
},
InsufficientHeaderMethods {
header_num_methods: u16,
metadata_method_index: u16,
},
MetadataNumMethodsMismatch {
header_num_methods: u16,
metadata_num_methods: u16,
},
UnexpectedInstruction {
instruction: Instruction,
},
UnexpectedTrailingCodeBytes {
num_bytes: usize,
},
}Expand description
Error for ContractFile::parse()
Variants§
FileTooLarge
The file is too large, must fit into u32
NoHeader
The file does not have a header (not enough bytes)
WrongMagicBytes
The magic bytes in the header are incorrect
MetadataOutOfRange
The metadata section is out of bounds of the file
Fields
MetadataDecoding
Failed to decode metadata item
FileTooSmall
The file is too small
Fields
MethodOutOfRange
Method offset is out of bounds of the file
Fields
HostCallFnOutOfRange
The host call function offset is out of bounds of the file
Fields
InvalidHostCallFnPattern
Host call function doesn’t have auipc + jalr tailcall pattern
Fields
first: InstructionFirst instruction of the host call function
second: InstructionSecond instruction of the host call function
InvalidReadOnlySizes
The read-only section file size is larger than the memory size
Fields
InsufficientHeaderMethods
There are not enough methods in the header to match the number of methods in the actual metadata
Fields
MetadataNumMethodsMismatch
The number of methods in the header does not match the number of methods in the actual metadata
Fields
UnexpectedInstruction
Unexpected instruction encountered while parsing the code section
Fields
instruction: InstructionInstruction
UnexpectedTrailingCodeBytes
Unexpected trailing code bytes encountered while parsing the code section
Trait Implementations§
Source§impl Debug for ContractFileParseError
impl Debug for ContractFileParseError
Source§impl Display for ContractFileParseError
impl Display for ContractFileParseError
Source§impl Error for ContractFileParseError
impl Error for ContractFileParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for ContractFileParseError
impl RefUnwindSafe for ContractFileParseError
impl Send for ContractFileParseError
impl Sync for ContractFileParseError
impl Unpin for ContractFileParseError
impl UnwindSafe for ContractFileParseError
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more