summaryrefslogtreecommitdiffhomepage
path: root/src/rust (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-08-26Rust/unit-wasm-sys: Remove reference to wrapper.h from build.rsAndrew Clayton1-1/+0
There is no wrapper.h in the repository. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-26Rust/unit-wasm-sys: Run build.rs through rustfmtAndrew Clayton1-3/+4
This in preparation for some upcoming changes. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-25Rust: Add a nicer wrapper around the libunit-wasm bindingsAndrew Clayton5-0/+225
This adds a nice wrapper (aka rusty) around the generated libunit-wasm bindings. This should provide a more native rust like experience with the following benefits - No casting. So no things like 'as *mut c_void' - Native rust strings. So no things like '.as_ptr() as *const c_char' - Better ctx initialisation. Filed initialisation is now hidden away - Great reduction in the amount of unsafe {} blocks required - Generally more compact There are also some new macros - C2S!() converts a CStr to a Str - S2C!() converts a formatted Str to a Cstr using format!() - uwr_write_str!() a wrapper around luw_mem_writep_data and format!() This wrapper uses a uwr (Unit Wasm Rust) prefix under a 'rusty' namespace. The luw_http_hdr_iter() function proved tricky to wrap and the callback function still takes C style arguments due to the fact that this function is called from the libunit-wasm C library. The provided wrapper simply means we can use this without having to use an unsafe {} block around it in application code. Similarly with other functions that technically didn't need to be wrapped, wrapping them means that the unsafe {} blocks are hidden away. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-25Rust: Don't disable dead code warningsAndrew Clayton1-1/+0
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-25Rust/unit-wasm-sys: Bump the version of the crateAndrew Clayton2-2/+2
unit-wasm-sys 0.1.2 Might as well do this now before the code changes and we bump the version again. This version was published to crates.io Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-21Initial commitv0.1.0Andrew Clayton12-0/+168
libunit-wasm and example C and Rust WebAssembly modules for NGINX Unit. Co-developed-by: Timo Stark <t.stark@nginx.com> Co-developed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>