<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit-wasm.git/examples/rust/echo-request, branch master</title>
<subtitle>Development libraries (C &amp; Rust) for writing WebAssembly modules for NGINX Unit</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/'/>
<entry>
<title>unit-wasm 0.4.0</title>
<updated>2025-05-14T19:46:09+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2025-05-14T19:46:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=7ef2f181304f19aba59066a35c72e1a239a4218d'/>
<id>7ef2f181304f19aba59066a35c72e1a239a4218d</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Remove some redundant unsafe blocks</title>
<updated>2025-05-14T19:37:16+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2025-05-14T19:37:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=89900c002afb77366503330b513c2547b6cf1abd'/>
<id>89900c002afb77366503330b513c2547b6cf1abd</id>
<content type='text'>
... as noted by the compiler...

Fixes: 2cf492f ("examples/rust: Fix some new rustc warnings")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
... as noted by the compiler...

Fixes: 2cf492f ("examples/rust: Fix some new rustc warnings")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Fix some new rustc warnings</title>
<updated>2024-07-02T01:49:09+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-07-02T01:49:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=2cf492f49cfb05c5083c99a38634c2f40b6d3e84'/>
<id>2cf492f49cfb05c5083c99a38634c2f40b6d3e84</id>
<content type='text'>
With at least

  rustc 1.79.0 (129f3b996 2024-06-10) (Fedora 1.79.0-3.fc40)

We were getting warnings when building the rust examples like

warning: creating a mutable reference to mutable static is discouraged
  --&gt; src/lib.rs:75:40
   |
75 |     let ctx: *mut luw_ctx_t = unsafe { &amp;mut CTX };
   |                                        ^^^^^^^^ mutable reference to mutable static
   |
   = note: for more information, see issue #114447 &lt;https://github.com/rust-lang/rust/issues/114447&gt;
   = note: this will be a hard error in the 2024 edition
   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
   = note: `#[warn(static_mut_refs)]` on by default
help: use `addr_of_mut!` instead to create a raw pointer
   |
75 |     let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
   |                                        ~~~~~~~~~~~~~~~~~

So do like it says and use the addr_of_mut!() macro.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With at least

  rustc 1.79.0 (129f3b996 2024-06-10) (Fedora 1.79.0-3.fc40)

We were getting warnings when building the rust examples like

warning: creating a mutable reference to mutable static is discouraged
  --&gt; src/lib.rs:75:40
   |
75 |     let ctx: *mut luw_ctx_t = unsafe { &amp;mut CTX };
   |                                        ^^^^^^^^ mutable reference to mutable static
   |
   = note: for more information, see issue #114447 &lt;https://github.com/rust-lang/rust/issues/114447&gt;
   = note: this will be a hard error in the 2024 edition
   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
   = note: `#[warn(static_mut_refs)]` on by default
help: use `addr_of_mut!` instead to create a raw pointer
   |
75 |     let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
   |                                        ~~~~~~~~~~~~~~~~~

So do like it says and use the addr_of_mut!() macro.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>unit-wasm 0.3.0</title>
<updated>2023-10-19T18:35:12+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-19T18:35:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=01c43784ec53aa1ff22aca7e7ae6f18b4591b514'/>
<id>01c43784ec53aa1ff22aca7e7ae6f18b4591b514</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Do some simplification around unsafe {} blocks</title>
<updated>2023-10-17T18:01:06+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-17T17:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=9b17f64d301334b999a8138037d32ff72e951018'/>
<id>9b17f64d301334b999a8138037d32ff72e951018</id>
<content type='text'>
We can put the unsafe keyword as part of the function definition,
getting rid of the unsafe {} blocks in the functions themselves.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can put the unsafe keyword as part of the function definition,
getting rid of the unsafe {} blocks in the functions themselves.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>unit-wasm 0.2.0</title>
<updated>2023-08-30T13:56:03+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-30T13:56:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=d81bc9290edc8d1eb59ced024499359ccd4da77a'/>
<id>d81bc9290edc8d1eb59ced024499359ccd4da77a</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Update for new API additions</title>
<updated>2023-08-30T00:55:26+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-30T00:55:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=d62b8e93fdaf62a36c36437f987485f7be36e52f'/>
<id>d62b8e93fdaf62a36c36437f987485f7be36e52f</id>
<content type='text'>
Update the echo-request and upload-reflector examples for the new
uwr_http_add_header_content_type() and uwr_http_add_header_content_len()
functions.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Update the echo-request and upload-reflector examples for the new
uwr_http_add_header_content_type() and uwr_http_add_header_content_len()
functions.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Reduce the scope of an unsafe block in echo-request</title>
<updated>2023-08-29T22:51:39+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T22:51:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=71ba509e6d662e1e8e703a7e1e609e1b1f8eb929'/>
<id>71ba509e6d662e1e8e703a7e1e609e1b1f8eb929</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Update unit-wasm dependency version</title>
<updated>2023-08-28T21:26:28+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T21:26:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=c98d9d80111236b882883eeb8b00f533f1212bef'/>
<id>c98d9d80111236b882883eeb8b00f533f1212bef</id>
<content type='text'>
luw_http_add_header() no longer takes an idx argument.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
luw_http_add_header() no longer takes an idx argument.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libunit-wasm: Remove the idx argument from luw_http_add_header()</title>
<updated>2023-08-28T15:20:26+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T15:11:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=da5d9dc03b14b4d0f1ce0ce3ff093f387e148706'/>
<id>da5d9dc03b14b4d0f1ce0ce3ff093f387e148706</id>
<content type='text'>
This was used to specify the index of the response header being added,
starting at 0 and incrementing by one for each header.

Instead of having the programmer specify this, track it internally.

We add an extra check in luw_http_add_header() to make sure we aren't
trying to add more headers than we said with luw_http_init_headers(), if
we are, simply return.

This updates the API-C.md and the various examples and 'rusty' API
wrapper.

Suggested-by: Liam Crilly &lt;liam@nginx.com&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was used to specify the index of the response header being added,
starting at 0 and incrementing by one for each header.

Instead of having the programmer specify this, track it internally.

We add an extra check in luw_http_add_header() to make sure we aren't
trying to add more headers than we said with luw_http_init_headers(), if
we are, simply return.

This updates the API-C.md and the various examples and 'rusty' API
wrapper.

Suggested-by: Liam Crilly &lt;liam@nginx.com&gt;
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
