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:
@@ -13,17 +13,17 @@ pub fn dummy_imports(
|
||||
) -> Result<Vec<Extern>, HostRef<Trap>> {
|
||||
let mut imports = Vec::with_capacity(import_tys.len());
|
||||
for imp in import_tys {
|
||||
imports.push(match imp.r#type() {
|
||||
ExternType::ExternFunc(func_ty) => {
|
||||
imports.push(match imp.ty() {
|
||||
ExternType::Func(func_ty) => {
|
||||
Extern::Func(HostRef::new(DummyFunc::new(&store, func_ty.clone())))
|
||||
}
|
||||
ExternType::ExternGlobal(global_ty) => {
|
||||
ExternType::Global(global_ty) => {
|
||||
Extern::Global(HostRef::new(dummy_global(&store, global_ty.clone())?))
|
||||
}
|
||||
ExternType::ExternTable(table_ty) => {
|
||||
ExternType::Table(table_ty) => {
|
||||
Extern::Table(HostRef::new(dummy_table(&store, table_ty.clone())?))
|
||||
}
|
||||
ExternType::ExternMemory(mem_ty) => {
|
||||
ExternType::Memory(mem_ty) => {
|
||||
Extern::Memory(HostRef::new(dummy_memory(&store, mem_ty.clone())))
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user