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:
Alex Crichton
2019-12-06 16:19:55 -06:00
committed by GitHub
parent 3d69e04659
commit e134505b90
16 changed files with 226 additions and 174 deletions

View File

@@ -49,10 +49,10 @@ impl Extern {
pub fn r#type(&self) -> ExternType {
match self {
Extern::Func(ft) => ExternType::ExternFunc(ft.borrow().r#type().clone()),
Extern::Memory(ft) => ExternType::ExternMemory(ft.borrow().r#type().clone()),
Extern::Table(tt) => ExternType::ExternTable(tt.borrow().r#type().clone()),
Extern::Global(gt) => ExternType::ExternGlobal(gt.borrow().r#type().clone()),
Extern::Func(ft) => ExternType::Func(ft.borrow().r#type().clone()),
Extern::Memory(ft) => ExternType::Memory(ft.borrow().r#type().clone()),
Extern::Table(tt) => ExternType::Table(tt.borrow().r#type().clone()),
Extern::Global(gt) => ExternType::Global(gt.borrow().r#type().clone()),
}
}