You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: fix terminology confusion between platform bindings and WebAssembly Component Model
Major terminology clarification to avoid confusion between our platform-specific
bindings and the established WebAssembly Component Model guest/host terminology.
Key changes:
- Renamed guide from "Host vs WASM Bindings" to "Native vs Guest Bindings"
- Fixed Mermaid diagram syntax errors and reduced visual complexity
- Added clear explanation of WebAssembly Component Model terminology:
* Host: Runtime environment (wasmtime, browser) executing components
* Guest: WebAssembly component implementation running in host runtime
* WIT: Interface definitions describing component interfaces
Updated documentation to use consistent terminology:
- "Native platform bindings" ({name}_bindings_host): For native development tools
- "Guest component bindings" ({name}_bindings): For WebAssembly component implementations
This resolves critical confusion where our "host bindings" conflicted with
WebAssembly's "host runtime" terminology. The documentation now clearly
distinguishes between:
1. Platform compilation targets (native vs wasm32-wasip2)
2. WebAssembly Component Model roles (host runtime vs guest component)
Cross-references updated across troubleshooting guide and rule reference to
maintain consistency and help developers understand the dual binding architecture
without terminology conflicts.
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/guides/host-vs-wasm-bindings.mdx
+76-55Lines changed: 76 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,47 @@
1
1
---
2
-
title: Host vs WASM Bindings
3
-
description: Understanding when to use host-platform vs WASM-platform bindings for different development scenarios
2
+
title: Native vs Guest Bindings
3
+
description: Understanding when to use native platform bindings vs guest component bindings for different development scenarios
4
4
---
5
5
6
-
# Host vs WASM Bindings
6
+
# Native vs Guest Bindings
7
7
8
8
When you generate WIT bindings with `rust_wasm_component_bindgen`, you actually get **two different versions** of the same bindings compiled for different platforms. Understanding when to use each one is crucial for building effective WebAssembly component ecosystems.
9
9
10
+
> **Important Terminology**: In the WebAssembly Component Model, "host" refers to the runtime executing components (like wasmtime), while "guest" refers to the component implementation. Our bindings use different terminology to avoid confusion.
11
+
10
12
## The Two Binding Types
11
13
12
14
```mermaid
13
-
flowchart LR
15
+
flowchart TD
14
16
A[WIT Interface] --> B[Generated Rust Code]
15
-
B --> C[Host Bindings<br/>{name}_bindings_host]
16
-
B --> D[WASM Bindings<br/>{name}_bindings]
17
+
B --> C[Native Platform Bindings<br/>name_bindings_host]
18
+
B --> D[Guest Component Bindings<br/>name_bindings]
19
+
20
+
C --> E[Native Applications<br/>rust_binary, rust_test]
21
+
D --> F[Guest Components<br/>Component Implementation]
17
22
18
-
C --> E[Host Applications<br/>rust_binary, rust_test]
19
-
D --> F[WASM Components<br/>Component Implementation]
23
+
G[Host Runtime<br/>wasmtime] --> F
20
24
21
-
style C fill:#e8f5e8,stroke:#4caf50,stroke-width:2px
22
-
style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px
23
-
style E fill:#e8f5e8,stroke:#4caf50,stroke-width:2px
24
-
style F fill:#fff3e0,stroke:#f57c00,stroke-width:2px
2. **Implement**: Create component with WASM bindings
307
-
3. **Test**: Build test tools with host bindings
308
-
4. **Deploy**: Distribute WASM components
325
+
2. **Implement**: Create guest components with guest bindings
326
+
3. **Test**: Build test tools with native bindings
327
+
4. **Deploy**: Distribute guest components to host runtimes
309
328
310
329
## Summary
311
330
312
-
Host and WASM bindings enable a rich development ecosystem around WebAssembly components:
331
+
Native and guest bindings enable a rich development ecosystem around WebAssembly components:
313
332
314
-
- **Host bindings** provide native access to component interfaces for development tools
315
-
- **WASM bindings** enable actual component execution in WebAssembly runtimes
333
+
- **Native platform bindings** provide native access to component interfaces for development tools
334
+
- **Guest component bindings** enable actual component execution in WebAssembly host runtimes
316
335
- **Both are generated** from the same WIT interfaces, ensuring consistency
317
-
- **Choose based on context**: host applications use host bindings, components use WASM bindings
336
+
- **Choose based on context**: native applications use native bindings, guest components use guest bindings
337
+
338
+
This dual binding architecture resolves target triple mismatches while enabling powerful tooling and testing capabilities for WebAssembly component development.
318
339
319
-
This dual binding architecture resolves target triple mismatches while enabling powerful tooling and testing capabilities for WebAssembly component development.
340
+
> **Key Takeaway**: Don't confuse our "host bindings" (native platform) with the WebAssembly Component Model "host runtime" (wasmtime). They serve different purposes in the ecosystem.
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/reference/rules.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -228,11 +228,11 @@ rust_wasm_component(
228
228
Builds a Rust WebAssembly component with WIT binding generation. Compiles Rust source code into a WASM component and generates language bindings from WIT interfaces.
229
229
230
230
**Generated Targets:**
231
-
-`{name}_bindings_host`: Host-platform rust_library for host applications (e.g., test runners, benchmarks)
232
-
-`{name}_bindings`: WASM-platform rust_library for WASM components
233
-
-`{name}`: The final WASM component
231
+
-`{name}_bindings_host`: Native platform rust_library for native applications (e.g., test runners, benchmarks)
232
+
-`{name}_bindings`: Guest component rust_library for WebAssembly components
233
+
-`{name}`: The final guest component
234
234
235
-
> **📖 Deep Dive:** For detailed guidance on when to use host vs WASM bindings, see [Host vs WASM Bindings Guide](/guides/host-vs-wasm-bindings/).
235
+
> **📖 Deep Dive:** For detailed guidance on when to use native vs guest bindings, see [Native vs Guest Bindings Guide](/guides/host-vs-wasm-bindings/).
0 commit comments