From f43faae30c7be086ced82f609b4d9d4c048027b2 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 16:54:32 +0200 Subject: [PATCH 01/13] bump version --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d45887a1..1f736bae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ contract_test = ["parse_token", "publish", "access", "crypto", "std", "subscribe full_no_std = ["serde", "reqwest", "crypto", "parse_token", "blocking", "publish", "access", "subscribe", "tokio", "presence"] full_no_std_platform_independent = ["serde", "crypto", "parse_token", "blocking", "publish", "access", "subscribe", "presence"] pubnub_only = ["crypto", "parse_token", "blocking", "publish", "access", "subscribe", "presence"] -mock_getrandom = ["getrandom/custom"] +mock_getrandom = ["getrandom"] # TODO: temporary treated as internal until we officially release it subscribe = ["dep:futures"] presence = ["dep:futures"] @@ -101,7 +101,7 @@ bytes = { version = "1.4", default-features = false, optional = true } # crypto aes = { version = "0.8.2", optional = true } cbc = { version = "0.1.2", optional = true } -getrandom = { version = "0.2", optional = true } +getrandom = { version = "0.3", optional = true } # parse_token ciborium = { version = "0.2.1", default-features = false, optional = true } @@ -115,7 +115,7 @@ async-channel = { version = "1.8", optional = true } portable-atomic = { version = "1.3", optional = true, default-features = false, features = ["require-cas", "critical-section"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2", features = ["js"] } +getrandom = { version = "0.3", features = ["wasm_js"] } [dev-dependencies] async-trait = "0.1" @@ -126,7 +126,7 @@ cucumber = { version = "0.20.2", features = ["output-junit"] } reqwest = { version = "0.12", features = ["json"] } test-case = "3.0" hashbrown = { version = "0.14.0", features = ["serde"] } -getrandom = { version = "0.2", features = ["custom"] } +getrandom = { version = "0.3" } [build-dependencies] built = "0.6" From 913a19d83d8c95b18bd664549ed6b8950c935c0d Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 17:05:03 +0200 Subject: [PATCH 02/13] change functions --- src/core/retry_policy.rs | 4 +--- src/providers/crypto/cryptors/aes_cbc.rs | 2 +- src/providers/crypto/cryptors/legacy.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/retry_policy.rs b/src/core/retry_policy.rs index 841f4e42..caaf92bd 100644 --- a/src/core/retry_policy.rs +++ b/src/core/retry_policy.rs @@ -8,8 +8,6 @@ //! [`PubNub API`]: https://www.pubnub.com/docs //! [`pubnub`]: ../index.html -use getrandom::getrandom; - use crate::{core::PubNubError, lib::alloc::vec::Vec}; /// List of known endpoint groups (by context) @@ -310,7 +308,7 @@ impl RequestRetryConfiguration { let delay = delay_in_seconds * MICROS_IN_SECOND; let mut random_bytes = [0u8; 8]; - if getrandom(&mut random_bytes).is_err() { + if getrandom::fill(&mut random_bytes).is_err() { return Some(delay); } diff --git a/src/providers/crypto/cryptors/aes_cbc.rs b/src/providers/crypto/cryptors/aes_cbc.rs index aa2468b6..96cb34fd 100644 --- a/src/providers/crypto/cryptors/aes_cbc.rs +++ b/src/providers/crypto/cryptors/aes_cbc.rs @@ -49,7 +49,7 @@ impl AesCbcCryptor { fn initialization_vector(&self) -> [u8; AES_BLOCK_SIZE] { let mut random = [0u8; AES_BLOCK_SIZE]; - getrandom::getrandom(&mut random).ok(); + getrandom::fill(&mut random).ok(); random } diff --git a/src/providers/crypto/cryptors/legacy.rs b/src/providers/crypto/cryptors/legacy.rs index 725dc8fa..3ba7ccfb 100644 --- a/src/providers/crypto/cryptors/legacy.rs +++ b/src/providers/crypto/cryptors/legacy.rs @@ -64,7 +64,7 @@ impl LegacyCryptor { fn initialization_vector(&self) -> [u8; 16] { if self.use_random_iv { let mut random = [0u8; AES_BLOCK_SIZE]; - getrandom::getrandom(&mut random).ok(); + getrandom::fill(&mut random).ok(); random } else { *b"0123456789012345" From 9378506c594985a7ba5ec9144913e6e2fc767886 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 17:07:49 +0200 Subject: [PATCH 03/13] so it is supported now ;o? --- src/lib.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 81120649..0ea93510 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -336,16 +336,3 @@ mod lib { } } } - -// Mocking random for checking if `no_std` compiles. -// Don't use that feature in production. -#[cfg(feature = "mock_getrandom")] -mod mock_getrandom { - use getrandom::{register_custom_getrandom, Error}; - - pub fn do_nothing(_buf: &mut [u8]) -> Result<(), Error> { - Ok(()) - } - - register_custom_getrandom!(do_nothing); -} From a4e4e3002449260bc8d0ca8b8c05ac1759a0afa5 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 17:15:03 +0200 Subject: [PATCH 04/13] more fills --- tests/crypto/legacy/crypto_aescbc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/crypto/legacy/crypto_aescbc.rs b/tests/crypto/legacy/crypto_aescbc.rs index a537b1c9..422df9a7 100644 --- a/tests/crypto/legacy/crypto_aescbc.rs +++ b/tests/crypto/legacy/crypto_aescbc.rs @@ -145,7 +145,7 @@ impl AesCbcCrypto { Some(iv) => Vec::from(iv.as_slice()), None => { let mut random = [0u8; AES_BLOCK_SIZE]; - getrandom::getrandom(&mut random).ok(); + getrandom::fill(&mut random).ok(); Vec::from(random) } } From 5672c061f19a0860a3f46f37978ea73b38161395 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 17:15:35 +0200 Subject: [PATCH 05/13] custom implementation --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 0ea93510..c1d8e24e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -336,3 +336,16 @@ mod lib { } } } + +// Mocking random for checking if `no_std` compiles. +// Don't use that feature in production. +#[cfg(feature = "mock_getrandom")] +mod mock_getrandom { + #[no_mangle] + unsafe extern "Rust" fn __getrandom_v03_custom( + _dest: *mut u8, + _len: usize, + ) -> Result<(), getrandom::Error> { + Ok(()) + } +} From 53147f77c66b5fcab5d4385d0f1468489ba38133 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Tue, 21 Oct 2025 17:18:03 +0200 Subject: [PATCH 06/13] out fo the module --- src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c1d8e24e..bc7ba6eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -340,12 +340,10 @@ mod lib { // Mocking random for checking if `no_std` compiles. // Don't use that feature in production. #[cfg(feature = "mock_getrandom")] -mod mock_getrandom { - #[no_mangle] - unsafe extern "Rust" fn __getrandom_v03_custom( - _dest: *mut u8, - _len: usize, - ) -> Result<(), getrandom::Error> { - Ok(()) - } +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + _dest: *mut u8, + _len: usize, +) -> Result<(), getrandom::Error> { + Ok(()) } From 5a6fd5da8897ece00e3c946b79e78202253e5ce2 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 09:17:01 +0200 Subject: [PATCH 07/13] it should work now --- .github/workflows/run-validations.yml | 2 ++ Cargo.toml | 1 - src/lib.rs | 11 ----------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index ff034f09..878c6f3c 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -107,6 +107,8 @@ jobs: name: Check if `no_std` target compiles as expected runs-on: group: organization/Default + env: + RUSTFLAGS: '--cfg getrandom_backend="unsupported"' steps: - uses: actions/checkout@v5 diff --git a/Cargo.toml b/Cargo.toml index 1f736bae..aa180a91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,6 @@ contract_test = ["parse_token", "publish", "access", "crypto", "std", "subscribe full_no_std = ["serde", "reqwest", "crypto", "parse_token", "blocking", "publish", "access", "subscribe", "tokio", "presence"] full_no_std_platform_independent = ["serde", "crypto", "parse_token", "blocking", "publish", "access", "subscribe", "presence"] pubnub_only = ["crypto", "parse_token", "blocking", "publish", "access", "subscribe", "presence"] -mock_getrandom = ["getrandom"] # TODO: temporary treated as internal until we officially release it subscribe = ["dep:futures"] presence = ["dep:futures"] diff --git a/src/lib.rs b/src/lib.rs index bc7ba6eb..0ea93510 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -336,14 +336,3 @@ mod lib { } } } - -// Mocking random for checking if `no_std` compiles. -// Don't use that feature in production. -#[cfg(feature = "mock_getrandom")] -#[no_mangle] -unsafe extern "Rust" fn __getrandom_v03_custom( - _dest: *mut u8, - _len: usize, -) -> Result<(), getrandom::Error> { - Ok(()) -} From c25683c2307bbfbf2c11615606db399d942a5800 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 09:20:31 +0200 Subject: [PATCH 08/13] more changes --- .github/workflows/run-validations.yml | 2 +- examples/no_std/Cargo.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index 878c6f3c..8b0ba937 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -122,7 +122,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: check - args: --lib --no-default-features --features=full_no_std_platform_independent,mock_getrandom + args: --lib --no-default-features --features=full_no_std_platform_independent - name: Run cargo check tool to check if the additional example code are valid uses: actions-rs/cargo@v1 diff --git a/examples/no_std/Cargo.toml b/examples/no_std/Cargo.toml index 72374616..841c3d28 100644 --- a/examples/no_std/Cargo.toml +++ b/examples/no_std/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pubnub = { path = "../../", default-features = false, features = ["blocking", "serde", "publish", "subscribe", "presence"] } -serde = { version = "1.0", default-features = false, features = ["derive"] } -getrandom = { version = "0.2", default-features = false, features = ["custom"] } +pubnub = { path = "../../", default_features = false, features = ["blocking", "serde", "publish", "subscribe", "presence"] } +serde = { version = "1.0", default_features = false, features = ["derive"] } +getrandom = { version = "0.3", default_features = false } [[bin]] name = "publish" From 02d3e7a8bd05d0d9d932f68fa38fd0c1d426daac Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 09:31:31 +0200 Subject: [PATCH 09/13] more changes related to no std --- .github/workflows/run-validations.yml | 7 +++++-- examples/no_std/src/here_now.rs | 16 +++++++++++++++- examples/no_std/src/presence_state.rs | 16 +++++++++++++++- examples/no_std/src/publish.rs | 16 +++++++++++++++- examples/no_std/src/subscribe.rs | 19 ++++++++++++++++--- examples/no_std/src/where_now.rs | 16 +++++++++++++++- 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index 8b0ba937..018a7282 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -107,8 +107,7 @@ jobs: name: Check if `no_std` target compiles as expected runs-on: group: organization/Default - env: - RUSTFLAGS: '--cfg getrandom_backend="unsupported"' + steps: - uses: actions/checkout@v5 @@ -120,12 +119,16 @@ jobs: - name: Run cargo check tool to check if the `no_std` code are valid uses: actions-rs/cargo@v1 + env: + RUSTFLAGS: '--cfg getrandom_backend="unsupported"' with: command: check args: --lib --no-default-features --features=full_no_std_platform_independent - name: Run cargo check tool to check if the additional example code are valid uses: actions-rs/cargo@v1 + env: + RUSTFLAGS: '--cfg getrandom_backend="custom"' with: command: check args: --manifest-path examples/no_std/Cargo.toml --target thumbv7m-none-eabi diff --git a/examples/no_std/src/here_now.rs b/examples/no_std/src/here_now.rs index 0750b8d9..5e3e49b5 100644 --- a/examples/no_std/src/here_now.rs +++ b/examples/no_std/src/here_now.rs @@ -25,7 +25,6 @@ use pubnub::{ // As getrandom crate has limited support of targets, we need to provide custom // implementation of `getrandom` function. -getrandom::register_custom_getrandom!(custom_random); fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { // We're using `42` as a random number, because it's the answer // to the Ultimate Question of Life, the Universe, and Everything. @@ -37,6 +36,21 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { Ok(()) } +// This function is used to register the custom implementation of `getrandom` function. +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), Error> { + let buf = unsafe { + // fill the buffer with zeros + core::ptr::write_bytes(dest, 0, len); + // create mutable byte slice + core::slice::from_raw_parts_mut(dest, len) + }; + custom_random(buf) +} + // Many targets have very specific requirements for networking, so it's hard to // provide a generic implementation. // Depending on the target, you will probably need to implement `Transport` trait. diff --git a/examples/no_std/src/presence_state.rs b/examples/no_std/src/presence_state.rs index b2129252..806327ea 100644 --- a/examples/no_std/src/presence_state.rs +++ b/examples/no_std/src/presence_state.rs @@ -32,7 +32,6 @@ struct State { // As getrandom crate has limited support of targets, we need to provide custom // implementation of `getrandom` function. -getrandom::register_custom_getrandom!(custom_random); fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { // We're using `42` as a random number, because it's the answer // to the Ultimate Question of Life, the Universe, and Everything. @@ -44,6 +43,21 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { Ok(()) } +// This function is used to register the custom implementation of `getrandom` function. +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), Error> { + let buf = unsafe { + // fill the buffer with zeros + core::ptr::write_bytes(dest, 0, len); + // create mutable byte slice + core::slice::from_raw_parts_mut(dest, len) + }; + custom_random(buf) +} + // Many targets have very specific requirements for networking, so it's hard to // provide a generic implementation. // Depending on the target, you will probably need to implement `Transport` trait. diff --git a/examples/no_std/src/publish.rs b/examples/no_std/src/publish.rs index fae7a88b..cb03417d 100644 --- a/examples/no_std/src/publish.rs +++ b/examples/no_std/src/publish.rs @@ -33,7 +33,6 @@ struct Message { // As getrandom crate has limited support of targets, we need to provide custom // implementation of `getrandom` function. -getrandom::register_custom_getrandom!(custom_random); fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { // We're using `42` as a random number, because it's the answer // to the Ultimate Question of Life, the Universe, and Everything. @@ -45,6 +44,21 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { Ok(()) } +// This function is used to register the custom implementation of `getrandom` function. +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), Error> { + let buf = unsafe { + // fill the buffer with zeros + core::ptr::write_bytes(dest, 0, len); + // create mutable byte slice + core::slice::from_raw_parts_mut(dest, len) + }; + custom_random(buf) +} + // Many targets have very specific requirements for networking, so it's hard to // provide a generic implementation. // Depending on the target, you will probably need to implement `Transport` trait. diff --git a/examples/no_std/src/subscribe.rs b/examples/no_std/src/subscribe.rs index 64606394..d41c0b95 100644 --- a/examples/no_std/src/subscribe.rs +++ b/examples/no_std/src/subscribe.rs @@ -34,12 +34,10 @@ struct Message { // As getrandom crate has limited support of targets, we need to provide custom // implementation of `getrandom` function. -getrandom::register_custom_getrandom!(custom_random); fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { // We're using `42` as a random number, because it's the answer // to the Ultimate Question of Life, the Universe, and Everything. - // In your program, you should use proper random number generator that is - // supported by your target. + // In your program, you should use proper random number generator that is supported by your target. for i in buf.iter_mut() { *i = 42; } @@ -47,6 +45,21 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { Ok(()) } +// This function is used to register the custom implementation of `getrandom` function. +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), Error> { + let buf = unsafe { + // fill the buffer with zeros + core::ptr::write_bytes(dest, 0, len); + // create mutable byte slice + core::slice::from_raw_parts_mut(dest, len) + }; + custom_random(buf) +} + // Many targets have very specific requirements for networking, so it's hard to // provide a generic implementation. // Depending on the target, you will probably need to implement `Transport` diff --git a/examples/no_std/src/where_now.rs b/examples/no_std/src/where_now.rs index b2c0490c..77bbd181 100644 --- a/examples/no_std/src/where_now.rs +++ b/examples/no_std/src/where_now.rs @@ -25,7 +25,6 @@ use pubnub::{ // As getrandom crate has limited support of targets, we need to provide custom // implementation of `getrandom` function. -getrandom::register_custom_getrandom!(custom_random); fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { // We're using `42` as a random number, because it's the answer // to the Ultimate Question of Life, the Universe, and Everything. @@ -37,6 +36,21 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { Ok(()) } +// This function is used to register the custom implementation of `getrandom` function. +#[no_mangle] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), Error> { + let buf = unsafe { + // fill the buffer with zeros + core::ptr::write_bytes(dest, 0, len); + // create mutable byte slice + core::slice::from_raw_parts_mut(dest, len) + }; + custom_random(buf) +} + // Many targets have very specific requirements for networking, so it's hard to // provide a generic implementation. // Depending on the target, you will probably need to implement `Transport` trait. From e88bcaf79c17417ab45a36e7e87960513dba9c8b Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 12:28:04 +0200 Subject: [PATCH 10/13] serde alloc --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index aa180a91..82a1f761 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -90,7 +90,7 @@ sha2 = { version = "0.10", default-features = false } time = { version = "0.3", features = ["alloc"], default-features = false } # serde -serde = { version = "1.0", features = ["derive"], optional = true, default-features = false } +serde = { version = "1.0", features = ["derive", "alloc"], optional = true, default-features = false } serde_json = { version = "1.0", optional = true, features = ["alloc"], default-features = false } # reqwest From 057236e74f37b44f01c08d68bb0f5509ee45e002 Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 12:29:09 +0200 Subject: [PATCH 11/13] proper names --- examples/no_std/Cargo.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/no_std/Cargo.toml b/examples/no_std/Cargo.toml index 841c3d28..b719c9c7 100644 --- a/examples/no_std/Cargo.toml +++ b/examples/no_std/Cargo.toml @@ -6,9 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pubnub = { path = "../../", default_features = false, features = ["blocking", "serde", "publish", "subscribe", "presence"] } -serde = { version = "1.0", default_features = false, features = ["derive"] } -getrandom = { version = "0.3", default_features = false } +pubnub = { path = "../../", default-features = false, features = ["blocking", "serde", "publish", "subscribe", "presence"] } +serde = { version = "1.0", default-features = false, features = ["derive"] } [[bin]] name = "publish" From da0928a8f0c79786f4aced78d2c99357ad636e2f Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 12:32:10 +0200 Subject: [PATCH 12/13] ahh, it was important --- examples/no_std/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/no_std/Cargo.toml b/examples/no_std/Cargo.toml index b719c9c7..4a29c15c 100644 --- a/examples/no_std/Cargo.toml +++ b/examples/no_std/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] pubnub = { path = "../../", default-features = false, features = ["blocking", "serde", "publish", "subscribe", "presence"] } serde = { version = "1.0", default-features = false, features = ["derive"] } +getrandom = { version = "0.3", default_features = false } [[bin]] name = "publish" From a93a85028243ed2855780a78c63f5a1b37da30da Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 22 Oct 2025 12:35:49 +0200 Subject: [PATCH 13/13] fix error --- examples/no_std/src/here_now.rs | 2 +- examples/no_std/src/presence_state.rs | 2 +- examples/no_std/src/publish.rs | 2 +- examples/no_std/src/subscribe.rs | 2 +- examples/no_std/src/where_now.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/no_std/src/here_now.rs b/examples/no_std/src/here_now.rs index 5e3e49b5..ed1fa8bd 100644 --- a/examples/no_std/src/here_now.rs +++ b/examples/no_std/src/here_now.rs @@ -41,7 +41,7 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, -) -> Result<(), Error> { +) -> Result<(), getrandom::Error> { let buf = unsafe { // fill the buffer with zeros core::ptr::write_bytes(dest, 0, len); diff --git a/examples/no_std/src/presence_state.rs b/examples/no_std/src/presence_state.rs index 806327ea..eaa2e613 100644 --- a/examples/no_std/src/presence_state.rs +++ b/examples/no_std/src/presence_state.rs @@ -48,7 +48,7 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, -) -> Result<(), Error> { +) -> Result<(), getrandom::Error> { let buf = unsafe { // fill the buffer with zeros core::ptr::write_bytes(dest, 0, len); diff --git a/examples/no_std/src/publish.rs b/examples/no_std/src/publish.rs index cb03417d..6e6c4900 100644 --- a/examples/no_std/src/publish.rs +++ b/examples/no_std/src/publish.rs @@ -49,7 +49,7 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, -) -> Result<(), Error> { +) -> Result<(), getrandom::Error> { let buf = unsafe { // fill the buffer with zeros core::ptr::write_bytes(dest, 0, len); diff --git a/examples/no_std/src/subscribe.rs b/examples/no_std/src/subscribe.rs index d41c0b95..fd18543e 100644 --- a/examples/no_std/src/subscribe.rs +++ b/examples/no_std/src/subscribe.rs @@ -50,7 +50,7 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, -) -> Result<(), Error> { +) -> Result<(), getrandom::Error> { let buf = unsafe { // fill the buffer with zeros core::ptr::write_bytes(dest, 0, len); diff --git a/examples/no_std/src/where_now.rs b/examples/no_std/src/where_now.rs index 77bbd181..74d0e995 100644 --- a/examples/no_std/src/where_now.rs +++ b/examples/no_std/src/where_now.rs @@ -41,7 +41,7 @@ fn custom_random(buf: &mut [u8]) -> Result<(), getrandom::Error> { unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, -) -> Result<(), Error> { +) -> Result<(), getrandom::Error> { let buf = unsafe { // fill the buffer with zeros core::ptr::write_bytes(dest, 0, len);