1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Tairitsu - Generic WASM Component Runtime Engine
//!
//! This framework provides Docker-like image/container mechanisms for running WASM components.
//! It does not prescribe any specific WIT interface - users define their own.
//!
//! ## Architecture
//!
//! - [`Image`] - Represents a compiled WASM component (like a Docker image)
//! - [`Container`] - Represents a running instance of an Image (like a Docker container)
//! - [`Registry`] - Manages multiple Images and Containers (like a Docker daemon)
//! - [`WitInterface`] - User-defined WIT interface trait
//! - [`ContainerBuilder`] - Builder pattern for creating containers with custom WIT bindings
//!
//! ## Quick Start
//!
//! ```rust,no_run,ignore
//! use tairitsu::{Container, GuestInstance, Image};
//! use bytes::Bytes;
//!
//! // 1. Define your WIT interface (use wit-bindgen to generate bindings)
//! // wit-bindgen generates your WIT code...
//!
//! // 2. Create a WASM image
//! let wasm_binary = std::fs::read("my_component.wasm")?;
//! let image = Image::new(Bytes::from(wasm_binary))?;
//!
//! // 3. Create container (user handles WIT binding)
//! let container = Container::builder(image)?
//! .with_guest_initializer(|ctx| {
//! // Register your WIT interface
//! MyWit::add_to_linker(ctx.linker, |state| &mut state.my_data)?;
//! let instance = MyWit::instantiate(ctx.store, ctx.component, ctx.linker)?;
//! Ok(GuestInstance::new(instance))
//! })?
//! .build()?;
//! ```
//!
//! ## Helper Macros
//!
//! ```rust,no_run
//! use tairitsu::wit_interface;
//!
//! // Automatically generate WIT interface code
//! wit_interface! {
//! interface filesystem {
//! read: func(path: String) -> Result<Vec<u8>, String>;
//! write: func(path: String, data: Vec<u8>) -> Result<(), String>;
//! }
//! }
//! ```
// Dynamic invocation module (requires 'dynamic' feature)
pub use ;
// Dynamic invocation exports (requires 'dynamic' feature)
pub use ;
pub use ;
pub use Image;
pub use Registry;
// RON types (always exported, but only usable when 'ron' dependency is available)
pub use ;
// Re-export procedural macros
pub use ;
// Re-export wasmtime types for user convenience
pub use Component;
pub use ;
pub use ;
pub use ;
pub use GuestInfo;
pub use ;
// Helper macros are automatically available through the wit_helper module
// Usage: tairitsu::impl_wit_interface!(), tairitsu::simple_handler!(), etc.