runtime: use anyhow::Error instead of Box<dyn std::error::Error...>

This commit is contained in:
Pat Hickey
2021-10-21 11:36:48 -07:00
parent 2225722373
commit a5007f318f
6 changed files with 81 additions and 57 deletions

View File

@@ -20,7 +20,7 @@
)
)]
use std::error::Error;
use anyhow::Error;
mod export;
mod externref;
@@ -91,15 +91,25 @@ pub unsafe trait Store {
) -> (&mut VMExternRefActivationsTable, &dyn ModuleInfoLookup);
/// Callback invoked to allow the store's resource limiter to reject a memory grow operation.
fn memory_growing(&mut self, current: usize, desired: usize, maximum: Option<usize>) -> bool;
fn memory_growing(
&mut self,
current: usize,
desired: usize,
maximum: Option<usize>,
) -> Result<bool, Error>;
/// Callback invoked to notify the store's resource limiter that a memory grow operation has
/// failed.
fn memory_grow_failed(&mut self, error: &anyhow::Error);
fn memory_grow_failed(&mut self, error: &Error);
/// Callback invoked to allow the store's resource limiter to reject a table grow operation.
fn table_growing(&mut self, current: u32, desired: u32, maximum: Option<u32>) -> bool;
fn table_growing(
&mut self,
current: u32,
desired: u32,
maximum: Option<u32>,
) -> Result<bool, Error>;
/// Callback invoked whenever fuel runs out by a wasm instance. If an error
/// is returned that's raised as a trap. Otherwise wasm execution will
/// continue as normal.
fn out_of_gas(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>;
fn out_of_gas(&mut self) -> Result<(), Error>;
}