Crate wasefire_applet_api
source ·Expand description
Applet-side of the applet API.
This api crate provides Rust bindings for the Wasm-side of the applet API.
Users should not directly use those bindings but instead use the prelude crate
that provides higher-level and more convenient access.
The bindings in this crate are automatically generated from a proc-macro based
on a procedural description of the applet API defined in the api-desc crate.
As such, they follow a precise convention:
- The module hierarchy in the applet API is mapped to the module hierarchy in this crate.
- Type definitions (like enums) are mapped to their definition. If an enum is
used as an error, it provides a
Error::to_result(isize) -> Result<usize, Error>method to convert signed integer results into RustResult. - Functions are mapped to their definition but also to a module of the same
name. This module defines 2 structs:
Paramsfor the parameters of the function andResultsfor the results of the function. If a struct is empty, then it is not used. - All parameters and results are 32-bits integers mapping to the
i32Wasm type, but their Rust type reflect their role. For example:usizefor unsigned integersisizefor signed integers (which may represent someResult<u31, u31>where the error type may be converted to some enum)*const u8and*mut u8for opaque/polymorphic pointers*const Tand*mut Tfor transparent pointers whereTis recursively definedextern "C" fn(data: *mut u8, ...)for closures over some opaque data and possibly additional parameters
Modules
- Button and touch operations.
- Clock and timer operations.
- Cryptographic operations.
- Debugging operations.
- LED operations.
- Random number generators.
- Persistent storage operations.
- Module of
syscall. - USB operations.
Functions
- Board-specific syscalls.