1 //! windows-specific extension for the `wasmtime` crate.
2 //!
3 //! This module is only available on Windows targets.
4 //! It is not available on Linux or macOS, for example. Note that the import path for
5 //! this module is `wasmtime::windows::...`, which is intended to emphasize that it
6 //! is platform-specific.
7 //!
8 //! The traits contained in this module are intended to extend various types
9 //! throughout the `wasmtime` crate with extra functionality that's only
10 //! available on Windows.
11 
12 use crate::Store;
13 
14 /// Extensions for the [`Store`] type only available on Windows.
15 pub trait StoreExt {
16     /// Configures a custom signal handler to execute.
17     ///
18     /// TODO: needs more documentation.
set_signal_handler<H>(&self, handler: H) where H: 'static + Fn(winapi::um::winnt::PEXCEPTION_POINTERS) -> bool19     unsafe fn set_signal_handler<H>(&self, handler: H)
20     where
21         H: 'static + Fn(winapi::um::winnt::PEXCEPTION_POINTERS) -> bool;
22 }
23 
24 impl StoreExt for Store {
set_signal_handler<H>(&self, handler: H) where H: 'static + Fn(winapi::um::winnt::PEXCEPTION_POINTERS) -> bool,25     unsafe fn set_signal_handler<H>(&self, handler: H)
26     where
27         H: 'static + Fn(winapi::um::winnt::PEXCEPTION_POINTERS) -> bool,
28     {
29         *self.signal_handler_mut() = Some(Box::new(handler));
30     }
31 }
32