wit-bindgen-wcl

Crates.iowit-bindgen-wcl
lib.rswit-bindgen-wcl
version0.2.2
created_at2025-10-01 16:29:41.824251+00
updated_at2025-12-10 15:47:52.376371+00
descriptionRuntime-agnostic WebAssembly Component Model implementation
homepagehttps://github.com/HemantKArya/waclay
repositoryhttps://github.com/HemantKArya/waclay
max_upload_size
id1862898
size89,339
Hemant KArya (HemantKArya)

documentation

README

wit-bindgen-wcl

WIT Binding Generator for waclay - Transform WIT interfaces into beautiful, type-safe Rust code.

License Rust

⚠️ Experimental Warning: This tool is still experimental. Some features may work perfectly, others may not. It needs developer contributions to become stable.

✨ What makes this special?

wit-bindgen-wcl turns verbose WebAssembly Component Model code into clean, idiomatic Rust. Only works with waclay - purpose-built for the runtime-agnostic architecture.

Before (manual):

// 50+ lines of error-prone boilerplate...
let host_interface = linker.define_instance("example:demo/logger".try_into().unwrap()).unwrap();
host_interface.define_func("log", Func::new(&mut store, FuncType::new([ValueType::String], []), /* ... */))?;

After (generated):

impl LoggerHost for MyHost {
    fn log(&mut self, message: String) { println!("{}", message); }
}
imports::register_loggerHost(&mut linker, &mut store)?;

🚀 Quick Start

# Install
cargo install wit-bindgen-wcl

# Generate bindings
wit-bindgen-wcl my-interface.wit bindings.rs

# Use in code
mod bindings;
use bindings::*;

🎯 Features

  • 🔒 Type Safety - Full Rust type system for WIT types
  • 🎭 Host Traits - Clean trait-based host function implementations
  • ⚡ Export Helpers - Type-safe access to guest functions
  • 🚀 Zero Cost - Same performance as hand-written code
  • 🔄 Hot Reload - Regenerate bindings instantly

📚 Examples

Nine real-world examples in examples/:

  • 🧮 Calculator - Complex math with error handling
  • 📁 File Manager - Permissions and file operations
  • 🕷️ Web Scraper - Deeply nested data structures
  • 🔧 Utilities - Lists, records, variants, options, results
# Test all examples
./test-wit-bindgen.ps1

🛠️ WIT Support

  • ✅ Records, Variants, Enums
  • ✅ Options, Results, Lists
  • ✅ Primitives & Nested Types
  • 🚧 Resources, Flags (soon)

⚠️ Important

  • waclay exclusive - Built specifically for waclay
  • Regenerate on changes - Update bindings when WIT files change
  • Version aware - Different versions may have incompatible bindings

🤝 Contributing

Help us add resources, flags, and more WIT features!

📄 License

Apache-2.0

Commit count: 0

cargo fmt