summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2025-05-17 18:09:11 +0100
committerAndrew Clayton <a.clayton@nginx.com>2025-05-17 18:09:11 +0100
commit87a97eb296adfc535fc1cb9208102f8466b9055a (patch)
tree2488fae0bd7004e1ea9d9ab5a66ea899e98bd88e
parent7ef2f181304f19aba59066a35c72e1a239a4218d (diff)
downloadunit-wasm-87a97eb296adfc535fc1cb9208102f8466b9055a.tar.gz
unit-wasm-87a97eb296adfc535fc1cb9208102f8466b9055a.tar.bz2
API-Rust.md: Remove some redundant unsafe blocks from example code
Mirrors changes in 89900c0 ("examples/rust: Remove some redundant unsafe blocks") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
-rw-r--r--API-Rust.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/API-Rust.md b/API-Rust.md
index bef2e7d..9b4a9d9 100644
--- a/API-Rust.md
+++ b/API-Rust.md
@@ -492,7 +492,7 @@ static mut REQUEST_BUF: *mut u8 = null_mut();
*/ ... */
#[no_mangle]
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
- let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
+ let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
if unsafe { REQUEST_BUF.is_null() } {
uwr_init_ctx(ctx, addr, 0 /* Response offset */);
@@ -507,7 +507,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
*/
uwr_set_req_buf(
ctx,
- unsafe { addr_of_mut!(REQUEST_BUF) },
+ addr_of_mut!(REQUEST_BUF),
LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
);
} else {
@@ -811,7 +811,7 @@ Example
```Rust
#[no_mangle]
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
- let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
+ let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
if unsafe { REQUEST_BUF.is_null() } {
uwr_init_ctx(ctx, addr, 0 /* Response offset */);
@@ -826,7 +826,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
*/
uwr_set_req_buf(
ctx,
- unsafe { addr_of_mut!(REQUEST_BUF) },
+ addr_of_mut!(REQUEST_BUF),
LUW_SRB_APPEND | LUW_SRB_ALLOC | LUW_SRB_FULL_SIZE,
);
} else {
@@ -868,7 +868,7 @@ Example
```Rust
pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
- let ctx: *mut luw_ctx_t = unsafe { addr_of_mut!(CTX) };
+ let ctx: *mut luw_ctx_t = addr_of_mut!(CTX);
let mut f;
let bytes_wrote: isize;
let mut total = unsafe { TOTAL_BYTES_WROTE };
@@ -877,7 +877,7 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
uwr_init_ctx(ctx, addr, 0);
uwr_set_req_buf(
ctx,
- unsafe { addr_of_mut!(REQUEST_BUF) },
+ addr_of_mut!(REQUEST_BUF),
LUW_SRB_NONE
);