Skip to content

Commit

Permalink
refactor(plugins): rename struct to fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
doinkythederp authored and lthoerner committed Sep 5, 2023
1 parent 9951b12 commit d626bb4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ impl Display for ExecutableError {
PathNoLongerExists(path) => {
write!(f, "Path '{}' no longer exists", path.display())
}
FailedToExecute(exit_code) => {
write!(f, "Executable failed with exit code {}", exit_code)
FailedToExecute(status_code) => {
write!(f, "Executable failed with status code {}", status_code)
}
CouldNotWait => write!(f, "Failed to wait for executable to complete"),
}
Expand Down
11 changes: 6 additions & 5 deletions src/plugins/memory/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ pub trait WasmMemoryManager<T: Send + Sync = StoreData>: Send + Sync {
}

#[derive(Debug, Snafu)]
pub enum CooperativeMemoryManagerError {
#[snafu(context(suffix(NotFoundSnafu)))]
pub enum ExportNotFoundError {
/// Users should try recompiling with `RUSTFLAGS="-Clink-arg=--export-table"`
#[snafu(display("WASM code must export a Memory table named `memory`"))]
MemoryNotFound { backtrace: Backtrace },
Memory { backtrace: Backtrace },
#[snafu(display("WASM code must export a `mem_alloc` function"))]
AllocNotFound {
Alloc {
backtrace: Backtrace,
source: wasmtime::Error,
},
#[snafu(display("WASM code must export a `mem_free` function"))]
DeallocNotFound {
Dealloc {
backtrace: Backtrace,
source: wasmtime::Error,
},
Expand All @@ -74,7 +75,7 @@ impl<T: Send + Sync> CooperativeMemoryManager<T> {
pub fn new(
mut store: &mut Store<StoreData>,
instance: &Instance,
) -> Result<Self, CooperativeMemoryManagerError> {
) -> Result<Self, ExportNotFoundError> {
Ok(Self {
memory: instance
.get_memory(&mut store, "memory")
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use wasmtime_wasi::WasiCtxBuilder;

use super::{
memory::{
manager::{CooperativeMemoryManager, CooperativeMemoryManagerError},
manager::{CooperativeMemoryManager, ExportNotFoundError},
WasmSpan,
},
StoreData, WasmPluginContext,
Expand All @@ -31,7 +31,7 @@ pub enum PluginBuilderError {
#[snafu(display("Failed to initialize memory: {source}"), context(false))]
MemoryInit {
backtrace: Backtrace,
source: CooperativeMemoryManagerError,
source: ExportNotFoundError,
},
}

Expand Down

0 comments on commit d626bb4

Please sign in to comment.