Refactor the types.rs types and structures (#681)
* Refactor the `types.rs` types and structures A few changes applied along the way: * Documentation added to most methods and types. * Limits are now stored with the maximum as optional rather than a sentinel u32 value for `None`. * The `Name` type was removed in favor of just using a bare `String`. * The `Extern` prefix in the varaints of `ExternType` has been removed since it was redundant. * Accessors of `ExternType` variants no longer panic, and unwrapping versions were added with "unwrap" in the name. * Fields and methods named `r#type` were renamed to `ty` to avoid requiring a raw identifier to use them. * Remove `fail-fast: false` This was left around since the development of GitHub Actions for wasmtime, but they're no longer needed! * Fix compilation of the test-programs code * Fix compilation of wasmtime-py package * Run rustfmt
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::module::Module;
|
||||
use crate::r#ref::HostRef;
|
||||
use crate::runtime::Store;
|
||||
use crate::trampoline::take_api_trap;
|
||||
use crate::types::{ExportType, ExternType, Name};
|
||||
use crate::types::{ExportType, ExternType};
|
||||
use anyhow::Result;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -122,7 +122,7 @@ impl Instance {
|
||||
.exports()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|(_, e)| e.name().as_str() == name)?;
|
||||
.find(|(_, e)| e.name() == name)?;
|
||||
Some(&self.exports()[i])
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ impl Instance {
|
||||
let _ = store.borrow_mut().register_wasmtime_signature(signature);
|
||||
}
|
||||
let extern_type = ExternType::from_wasmtime_export(&export);
|
||||
exports_types.push(ExportType::new(Name::new(name), extern_type));
|
||||
exports_types.push(ExportType::new(name, extern_type));
|
||||
exports.push(Extern::from_wasmtime_export(
|
||||
store,
|
||||
instance_handle.clone(),
|
||||
|
||||
Reference in New Issue
Block a user