Skip to content

Commit

Permalink
Enable clocks-timezone feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmurph32 committed Jul 2, 2024
1 parent 04fbb1d commit 33a55d0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions crates/wasi-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub mod bindings {
trappable_error_type: {
"wasi:http/types/error-code" => crate::HttpError,
},
features: ["clocks-timezone"],
});

pub use wasi::http;
Expand Down
2 changes: 2 additions & 0 deletions crates/wasi-http/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod bindings {
"wasi:http": crate::bindings::http,
"wasi": wasmtime_wasi::bindings,
},
features: ["clocks-timezone"],
});
}

Expand Down Expand Up @@ -140,6 +141,7 @@ pub mod sync {
"wasi": wasmtime_wasi::bindings, // everything else
},
require_store_data_send: true,
features: ["clocks-timezone"],
});
}

Expand Down
3 changes: 3 additions & 0 deletions crates/wasi-preview1-component-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub mod bindings {
// Instead, we manually define the bindings for these functions in
// terms of raw pointers.
skip: ["run", "get-environment", "poll"],
features: ["clocks-timezone"],
});

#[cfg(feature = "reactor")]
Expand All @@ -78,6 +79,7 @@ pub mod bindings {
// Instead, we manually define the bindings for these functions in
// terms of raw pointers.
skip: ["get-environment", "poll"],
features: ["clocks-timezone"],
});

#[cfg(feature = "proxy")]
Expand All @@ -99,6 +101,7 @@ pub mod bindings {
raw_strings,
runtime_path: "crate::bindings::wit_bindgen_rt_shim",
skip: ["poll"],
features: ["clocks-timezone"],
});

pub mod wit_bindgen_rt_shim {
Expand Down
4 changes: 2 additions & 2 deletions crates/wasi/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Generate traits for synchronous bindings.
//
// Note that this is only done for interfaces which can block, or those which
// have some functions in `only_imports` below for being async.
pub mod sync {
Expand Down Expand Up @@ -40,6 +38,7 @@ pub mod sync {
"wasi:sockets/udp/udp-socket": super::super::sockets::udp::UdpSocket,
},
require_store_data_send: true,
features: ["clocks-timezone"],
});
}
pub use self::generated::exports;
Expand Down Expand Up @@ -209,6 +208,7 @@ mod async_io {
"wasi:cli/terminal-input/terminal-input": crate::stdio::TerminalInput,
"wasi:cli/terminal-output/terminal-output": crate::stdio::TerminalOutput,
},
features: ["clocks-timezone"],
});
}

Expand Down
5 changes: 4 additions & 1 deletion crates/wasi/src/host/clocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ impl Subscribe for Deadline {
}
}

impl<T: WasiView> timezone::Host for T {
impl<T> timezone::Host for WasiImpl<T>
where
T: WasiView,
{
fn display(&mut self, when: Datetime) -> anyhow::Result<TimezoneDisplay> {
let duration = std::time::Duration::new(when.seconds, when.nanoseconds);
Ok(self.ctx().timezone.display(duration))
Expand Down
1 change: 1 addition & 0 deletions crates/wasi/wit/deps/cli/imports.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wasi:cli@0.2.0;

world imports {
@unstable(feature = clocks-timezone)
include wasi:clocks/imports@0.2.0;
include wasi:filesystem/imports@0.2.0;
include wasi:sockets/imports@0.2.0;
Expand Down

0 comments on commit 33a55d0

Please sign in to comment.