pub enum RuntimeError {
AllocationTooLarge,
InvalidAlignment,
AllocationFailed,
DeallocateInvalidAddress,
FunctionNotFound(String),
NotAFunction(String),
MissingMemory,
NotMemory,
InvalidString(FromUtf8Error),
InvalidNumber(TryFromIntError),
InvalidVariant {
type_name: &'static str,
discriminant: i64,
},
Custom(Error),
}Expand description
Errors that can occur when using a Wasm runtime.
Variants§
AllocationTooLarge
Attempt to allocate a buffer larger than i32::MAX.
InvalidAlignment
Attempt to allocate a buffer that’s aligned to an invalid boundary.
AllocationFailed
Call to cabi_realloc returned a negative value instead of a valid address.
DeallocateInvalidAddress
Attempt to deallocate an address that’s after i32::MAX.
FunctionNotFound(String)
Attempt to load a function not exported from a module.
NotAFunction(String)
Attempt to load a function with a name that’s used for a different import in the module.
MissingMemory
Attempt to load the memory export from a module that doesn’t export it.
NotMemory
Attempt to load the memory export from a module that exports it as something else.
InvalidString(FromUtf8Error)
Attempt to load a string from a sequence of bytes that doesn’t contain a UTF-8 string.
InvalidNumber(TryFromIntError)
Attempt to create a GuestPointer from an invalid address representation.
InvalidVariant
Attempt to load an enum type but the discriminant doesn’t match any of the variants.
Fields
Custom(Error)
A custom error reported by one of the Wasm host’s function handlers.
Trait Implementations§
Source§impl Debug for RuntimeError
impl Debug for RuntimeError
Source§impl Display for RuntimeError
impl Display for RuntimeError
Source§impl Error for RuntimeError
impl Error for RuntimeError
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
Source§impl From<FromUtf8Error> for RuntimeError
impl From<FromUtf8Error> for RuntimeError
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Source§impl From<TryFromIntError> for RuntimeError
impl From<TryFromIntError> for RuntimeError
Source§fn from(source: TryFromIntError) -> Self
fn from(source: TryFromIntError) -> Self
Auto Trait Implementations§
impl Freeze for RuntimeError
impl RefUnwindSafe for RuntimeError
impl Send for RuntimeError
impl Sync for RuntimeError
impl Unpin for RuntimeError
impl UnwindSafe for RuntimeError
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
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
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 moreSource§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.