wasm_embedded_spec/
api.rs

1//! API module provides wiggle and bindgen based platform API definitions.
2
3#![allow(
4    non_snake_case,
5    non_camel_case_types,
6    non_upper_case_globals,
7    clippy::all
8)]
9
10#[cfg(feature = "wiggle")]
11use crate::Error;
12
13#[cfg(feature = "bindgen")]
14pub use cty::c_char;
15
16// Load WITX interface specifications if enabled
17// https://docs.rs/wiggle/0.28.0/wiggle/macro.from_witx.html
18#[cfg(feature = "wiggle")]
19wiggle::from_witx!({
20    witx: [
21        "./witx/common.witx",
22        "./witx/spi.witx",
23        "./witx/i2c.witx",
24        "./witx/uart.witx",
25        "./witx/gpio.witx",
26        "./witx/device.witx",
27    ],
28    errors: { errno => Error },
29});
30
31#[cfg(feature = "wiggle")]
32pub use types::{Errno, UserErrorConversion};
33
34#[cfg(feature = "wiggle")]
35impl wiggle::GuestErrorType for types::Errno {
36    fn success() -> Self {
37        types::Errno::Ok
38    }
39}
40
41// Include generated bindings if enabled
42#[cfg(feature = "bindgen")]
43include!(concat!(env!("OUT_DIR"), "/bindings.rs"));