Change the name of wit-bindgen's host implementation traits. (#5890)
* Change the name of wit-bindgen's host implementation traits. Instead of naming the host implementation trait something like `wasi_filesystem::WasiFilesystem`, name it `wasi_filesystem::Host`, and avoid using the identifier `Host` in other places. This fixes a collision when generating bindings for the current wasi-clock API, which contains an interface `wall-clock` which contains a type `wall-clock`, which created a naming collision on the name `WallClock`. * Update tests to use the new trait name. * Fix one more. * Add the new test interface to the simple-wasi world.
This commit is contained in:
@@ -97,7 +97,7 @@ mod one_import {
|
||||
hit: bool,
|
||||
}
|
||||
|
||||
impl foo::Foo for MyImports {
|
||||
impl foo::Host for MyImports {
|
||||
fn foo(&mut self) -> Result<()> {
|
||||
self.hit = true;
|
||||
Ok(())
|
||||
|
||||
@@ -60,7 +60,7 @@ mod empty_error {
|
||||
#[derive(Default)]
|
||||
struct MyImports {}
|
||||
|
||||
impl imports::Imports for MyImports {
|
||||
impl imports::Host for MyImports {
|
||||
fn empty_error(&mut self, a: f64) -> Result<Result<f64, ()>, Error> {
|
||||
if a == 0.0 {
|
||||
Ok(Ok(a))
|
||||
@@ -171,7 +171,7 @@ mod string_error {
|
||||
#[derive(Default)]
|
||||
struct MyImports {}
|
||||
|
||||
impl imports::Imports for MyImports {
|
||||
impl imports::Host for MyImports {
|
||||
fn string_error(&mut self, a: f64) -> Result<Result<f64, String>, Error> {
|
||||
if a == 0.0 {
|
||||
Ok(Ok(a))
|
||||
@@ -313,7 +313,7 @@ mod enum_error {
|
||||
#[derive(Default)]
|
||||
struct MyImports {}
|
||||
|
||||
impl imports::Imports for MyImports {
|
||||
impl imports::Host for MyImports {
|
||||
fn enum_error(&mut self, a: f64) -> Result<f64, imports::TrappableE1> {
|
||||
if a == 0.0 {
|
||||
Ok(a)
|
||||
@@ -440,7 +440,7 @@ mod record_error {
|
||||
#[derive(Default)]
|
||||
struct MyImports {}
|
||||
|
||||
impl imports::Imports for MyImports {
|
||||
impl imports::Host for MyImports {
|
||||
fn record_error(&mut self, a: f64) -> Result<f64, imports::TrappableE2> {
|
||||
if a == 0.0 {
|
||||
Ok(a)
|
||||
@@ -576,7 +576,7 @@ mod variant_error {
|
||||
#[derive(Default)]
|
||||
struct MyImports {}
|
||||
|
||||
impl imports::Imports for MyImports {
|
||||
impl imports::Host for MyImports {
|
||||
fn variant_error(&mut self, a: f64) -> Result<f64, imports::TrappableE3> {
|
||||
if a == 0.0 {
|
||||
Ok(a)
|
||||
|
||||
Reference in New Issue
Block a user