Age | Commit message (Collapse) | Author | Files | Lines | |
---|---|---|---|---|---|
2023-10-19 | unit-wasm 0.3.0v0.3.0 | Andrew Clayton | 1 | -1/+1 | |
Signed-off-by: Andrew Clayton <a.clayton@nginx.com> | |||||
2023-09-05 | rust: Change how bindgen creates enums | Andrew Clayton | 1 | -4/+4 | |
Previously bindgen was picking the 'constified_enum'. E.g it would turn the luw_srb_flags_t enum typedef enum { LUW_SRB_NONE = 0x00, LUW_SRB_APPEND = 0x01, LUW_SRB_ALLOC = 0x02, LUW_SRB_FULL_SIZE = 0x04, LUW_SRB_FLAGS_ALL = (LUW_SRB_NONE|LUW_SRB_APPEND|LUW_SRB_ALLOC| LUW_SRB_FULL_SIZE) } luw_srb_flags_t; into pub const luw_srb_flags_t_LUW_SRB_NONE: luw_srb_flags_t = 0; pub const luw_srb_flags_t_LUW_SRB_APPEND: luw_srb_flags_t = 1; pub const luw_srb_flags_t_LUW_SRB_ALLOC: luw_srb_flags_t = 2; pub const luw_srb_flags_t_LUW_SRB_FULL_SIZE: luw_srb_flags_t = 4; pub const luw_srb_flags_t_LUW_SRB_FLAGS_ALL: luw_srb_flags_t = 7; But then this requires some further changes to make the names nicer without the type prefixed. This will only be exasperated when adding an enum containing the HTTP status codes... So instead, tell bindgen to use the 'rustified_enum' method which produces this pub enum luw_srb_flags_t { LUW_SRB_NONE = 0, LUW_SRB_APPEND = 1, LUW_SRB_ALLOC = 2, LUW_SRB_FULL_SIZE = 4, LUW_SRB_FLAGS_ALL = 7, } which in theory requires no extra changes (it doesn't with the http status codes enum), however in this specific case, because these are actually bitflags we still need to cast them to u32 so they can be OR'd. Signed-off-by: Andrew Clayton <a.clayton@nginx.com> | |||||
2023-08-30 | unit-wasm 0.2.0v0.2.0 | Andrew Clayton | 1 | -1/+1 | |
Signed-off-by: Andrew Clayton <a.clayton@nginx.com> | |||||
2023-08-25 | Rust: Add a nicer wrapper around the libunit-wasm bindings | Andrew Clayton | 1 | -0/+5 | |
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-21 | Initial commitv0.1.0 | Andrew Clayton | 1 | -0/+15 | |
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> |