Document the wasmtime::Instance APIs (#814)
* Document the `wasmtime::Instance` APIs This documents oddities like the import list and export list and how to match them all up. Addtionally this largely just expands all the docs related to `Instance` to get filled out. This also moves the `set_signal_handler` functions into platform-specific modules in order to follow Rust idioms about how to expose platform-specific information. Additionally the methods are marked `unsafe` because I figure anything having to do with signal handling is `unsafe` inherently. I don't actually know what these functions do, so they're currently still undocumented. * Fix build of python bindings * Fix some rebase conflicts
This commit is contained in:
29
crates/api/src/windows.rs
Normal file
29
crates/api/src/windows.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
//! windows-specific extension for the `wasmtime` crate.
|
||||
//!
|
||||
//! This module is only available on Windows targets.
|
||||
//! It is not available on Linux or macOS, for example. Note that the import path for
|
||||
//! this module is `wasmtime::windows::...`, which is intended to emphasize that it
|
||||
//! is platform-specific.
|
||||
//!
|
||||
//! The traits contained in this module are intended to extend various types
|
||||
//! throughout the `wasmtime` crate with extra functionality that's only
|
||||
//! available on Windows.
|
||||
|
||||
use crate::Instance;
|
||||
|
||||
/// Extensions for the [`Instance`] type only available on Windows.
|
||||
pub trait InstanceExt {
|
||||
// TODO: docs?
|
||||
unsafe fn set_signal_handler<H>(&self, handler: H)
|
||||
where
|
||||
H: 'static + Fn(winapi::um::winnt::EXCEPTION_POINTERS) -> bool;
|
||||
}
|
||||
|
||||
impl InstanceExt for Instance {
|
||||
unsafe fn set_signal_handler<H>(&self, handler: H)
|
||||
where
|
||||
H: 'static + Fn(winapi::um::winnt::EXCEPTION_POINTERS) -> bool,
|
||||
{
|
||||
self.instance_handle.clone().set_signal_handler(handler);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user