spin_sdk/
lib.rs

1//! The Rust Spin SDK.
2
3#![deny(missing_docs)]
4
5#[cfg(test)]
6mod test;
7
8/// Key/Value storage.
9pub mod key_value;
10
11/// SQLite storage.
12pub mod sqlite;
13
14/// Large Language Model (Serverless AI) APIs
15pub mod llm;
16
17/// Exports the procedural macros for writing handlers for Spin components.
18pub use spin_macro::*;
19
20#[doc(hidden)]
21/// Module containing wit bindgen generated code.
22///
23/// This is only meant for internal consumption.
24pub mod wit {
25    #![allow(missing_docs)]
26
27    wit_bindgen::generate!({
28        world: "platform",
29        path: "./wit",
30        with: {
31            "wasi:io/error@0.2.0": spin_executor::bindings::wasi::io::error,
32            "wasi:io/streams@0.2.0": spin_executor::bindings::wasi::io::streams,
33            "wasi:io/poll@0.2.0": spin_executor::bindings::wasi::io::poll,
34        }
35    });
36    pub use fermyon::spin2_0_0 as v2;
37    pub use spin::postgres::postgres as pg3;
38}
39
40/// Needed by the export macro
41///
42/// See [this commit](https://github.com/bytecodealliance/wit-bindgen/pull/394/commits/9d2ea88f986f4a883ba243449e3a070cac18958e) for more info.
43#[cfg(target_arch = "wasm32")]
44#[doc(hidden)]
45pub use wit::__link_section;
46
47#[export_name = concat!("spin-sdk-version-", env!("SDK_VERSION"))]
48extern "C" fn __spin_sdk_version() {}
49
50#[cfg(feature = "export-sdk-language")]
51#[export_name = "spin-sdk-language-rust"]
52extern "C" fn __spin_sdk_language() {}
53
54#[export_name = concat!("spin-sdk-commit-", env!("SDK_COMMIT"))]
55extern "C" fn __spin_sdk_hash() {}
56
57/// Helpers for building Spin `wasi-http` components.
58pub mod http;
59
60#[allow(missing_docs)]
61pub mod mqtt;
62
63#[allow(missing_docs)]
64pub mod redis;
65
66pub mod pg;
67
68pub mod pg3;
69
70pub mod mysql;
71
72pub mod variables;
73
74#[doc(hidden)]
75pub use wit_bindgen;