Age | Commit message (Collapse) | Author | Files | Lines |
|
This takes into account the recent porting of the Rust demo applications
to the new 'rusty' wrappers.
The updates relate to the function handler names, the ones provided by
the application now use the uwr_ prefix, the malloc and free handlers
are still using the luw_ prefix as the applications aren't providing
their own versions of those, the ones from libunit-wasm will be used.
This is a useful demonstration of a number of things, but ultimately
that you can call these handlers anything you want.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
rusty is a thin wrapper over the generated libunit-wasm bindings to
provide a more native rust like interface.
This gets rid of all the casting and ugly string handling. It massively
reduces the amount of unsafe {} blocks needed, though some still are...
All in all this provides a nice code cleanup.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
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>
|
|
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
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>
|
|
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
There was a luw_destroy_ctx() function at one point and its prototype
was still in the header file...
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
No reason why this needed to be a separate #define.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
The wasi-sysroot is now packaged by Fedora in the wasi-libc-devel &
wasi-libc-static packages (just installing wasi-libc-devel should bring
in the other if needed).
We also no longer need bindgen-cli as we are building the rust stuff
from within the build.rs files.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
If you don't have WASI_SYSROOT set in the shell and you don't specify
it in the make command, then make will try and find the wasi-sysroot in
some known locations and then set the WASI_SYSROOT accordingly.
However in this case (no shell variable and not specified in the make
command) then when it comes to building the rust stuff, cargo build
fails when trying to generate the bindings as it needs the wasi-sysroot
but doesn't pick it up from the shell environment.
Fix this by exporting WASI_SYSROOT from shared.mk
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
Requested-by: Liam Crilly <liam@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
This makes some additions suggested by Liam (I didn't implement them
all, e.g I kept the $ signs in commands) and some changes of my own, e.g
expanded config and curl command in the rust quickstart section.
Suggested-by: Liam Crilly <liam@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
We have builds triggered on Makefile changes and shared.mk is included
in the Makefile.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
We have switched the repository from the preview to master branch ready
for its initial release.
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
|
|
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>
|