* 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
32 lines
1.2 KiB
Rust
32 lines
1.2 KiB
Rust
//! Unix-specific extension for the `wasmtime` crate.
|
|
//!
|
|
//! This module is only available on Unix targets, for example Linux and macOS.
|
|
//! It is not available on Windows, for example. Note that the import path for
|
|
//! this module is `wasmtime::unix::...`, 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 Unix.
|
|
|
|
use crate::Instance;
|
|
|
|
/// Extensions for the [`Instance`] type only available on Unix.
|
|
pub trait InstanceExt {
|
|
// TODO: needs more docs?
|
|
/// The signal handler must be
|
|
/// [async-signal-safe](http://man7.org/linux/man-pages/man7/signal-safety.7.html).
|
|
unsafe fn set_signal_handler<H>(&self, handler: H)
|
|
where
|
|
H: 'static + Fn(libc::c_int, *const libc::siginfo_t, *const libc::c_void) -> bool;
|
|
}
|
|
|
|
impl InstanceExt for Instance {
|
|
unsafe fn set_signal_handler<H>(&self, handler: H)
|
|
where
|
|
H: 'static + Fn(libc::c_int, *const libc::siginfo_t, *const libc::c_void) -> bool,
|
|
{
|
|
self.instance_handle.clone().set_signal_handler(handler);
|
|
}
|
|
}
|