Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 8798e5d

Browse files
author
Timo Stark
authored
Apply suggestions from code review
1 parent 651c083 commit 8798e5d

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

source/news/2024/wasm-component-model-part-1.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ The WIT files used by the Wasm Component Model and the **wasi:http/proxy** world
5757
One of the interesting facts about WIT-files is the versioning system. As the host implementing the Wasm runtime as well as the component we are about to build are creating bindings for the contracts defined by the WIT files, it is important to target the same version of those contracts or choose a runtime that supports multiple versions of those WIT files. But this is worth another blog post. For now, we should focus on the latest stable release, which it was published in February 2024 and is labeled as WASI 0.2.
5858
This release included **wasi:cli** and the **wasi:http** worlds.
5959

60-
In the Wasm ecosystem these contracts are called worlds. So, we will do from now on. For the use cases of NGINX Unit it was pretty
61-
clear we will targeting the **wasi/http:proxy** world. You can think of the **wasi:http/proxy** world as the set of interfaces describing
62-
how a HTTP request and response will look like including all its data (HTTP Method, Headers, Body, etc.). If you are an old school web
63-
developer, this might remind you of CGI.
60+
In the WebAssembly ecosystem, these contracts are referred to as "worlds." Therefore, we will use that term from now on. For the use cases of NGINX Unit, it was pretty clear we will be targeting the **wasi:http/proxy** world. You can think of the **wasi:http/proxy** world as the set of interfaces describing how a HTTP request and response will look like, including all its data (HTTP Method, Headers, Body, and more). If you are an old-school web developer, this might remind you of CGI.
6461

6562
************************************************************************
6663
NGINX Unit, Wasmtime and Rust - A runtime implementation
@@ -71,10 +68,9 @@ After a brief investigation, we discovered that the WASI/WIT pair we'd already h
7168
As mentioned at the beginning of this article, any challenge, regardless of its complexity, can be solved when the right people and community share the same mindset.
7269
Fermyon has been, and continues to be, a valuable and significant partner for us. After a late-night Slack and Zoom Session, we found it too complex to add native support for the Component Model to the Wasmtime C-API. Additionally, implementing the interfaces manually with WIT files without help from automation tools like **bindgen** would result in a significant amount of ongoing upkeep work.
7370

74-
While explaining how the internals of NGINX Unit and the current C-based Language Module work to Fermyon they shared a prototype of a
75-
Rust based Unit Language Module targeting the Rust-API of Wasmtime. Not the C-API anymore.
71+
While explaining how the internals of NGINX Unit and the current C-based Language Module work to Fermyon, they shared a prototype of a Rust-based Unit Language Module targeting the Rust API of Wasmtime. Not the C-API anymore.
7672

77-
This was the moment we added Rust to the core of NGINX Unit. With all this knowledge we are now ready to write some code.
73+
Now we are equipped with the necessary knowledge to write some code.
7874

7975
************************************************************************
8076
What's next?

source/news/2024/wasm-component-model-part-2.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ After the installation completes, you can confirm the current version of Rust by
2929
$ rustc -V
3030
rustc 1.76.0 (07dca489a 2024-02-04)
3131
32-
To work with Wasm Components, we need some additional tooling. This is a one-time setup for your machine to be able to write Rust source
33-
code and compile it to a WebAssembly Component.
32+
To work with Wasm Components, we need some additional tooling. This is a one-time setup for you to be able to write Rust source code and compile it to a Wasm Component.
3433

3534
==========================================================================
3635
Add the wasm32-wasi compiler target
@@ -75,7 +74,7 @@ Using the **wasi** Rust library
7574

7675
Our experience with the official WASI Rust library was very interesting and exciting. The component build time was fascinating, and the library has a low dependency footprint. However, there are some costs in terms of developer experience. See for yourselves:
7776

78-
Start by creating a new Wasm Component using cargo component:
77+
Start by creating a new Wasm Component using **cargo component**:
7978

8079
.. code-block:: bash
8180
@@ -158,9 +157,7 @@ The actual code from **src/lib.rs** should look like this:
158157
}
159158
}
160159
161-
As you can see, targeting the wasi crate requires some low-level Rust work by us. Not bad at all but something to consider when choosing this
162-
option. For the **wasi/http:proxy** world there is an interface description available on `Github <https://github.com/WebAssembly/wasi-http/blob/main/proxy.md>`__
163-
which will help to write your code.
160+
Targeting the wasi crate requires some low-level Rust work by us. Not bad at all, but something to consider when choosing this option. For the **wasi:http/proxy** world there is an interface description available on `Github <https://github.com/WebAssembly/wasi-http/blob/main/proxy.md>`__ which will help to write your code.
164161

165162
Let's build the component. Run the following command from the **test-wasi-component** directory:
166163

0 commit comments

Comments
 (0)