1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-FileCopyrightText: 2026 Roman Valls Guimera <brainstorm@nopcode.org>
// SPDX-FileCopyrightText: 2026 Julio Beltran Ortega <jubeormk1@gmail.com>
// SPDX-FileCopyrightText: 2026 Angus Gratton <gus@projectgus.com>
// SPDX-FileCopyrightText: 2026 Gabriel Ku Wei Bin <gabriel.ku@fsfe.org>
// SPDX-FileCopyrightText: 2026 Anthony Tambasco <anthony.tambasco@fastmail.com>
//
// SPDX-License-Identifier: GPL-3.0-or-later
//! Random number generation trait.
use Future;
use crateHalError;
/// Random number generation hardware abstraction.
///
/// Provides cryptographically secure random number generation.
/// Implementations typically wrap hardware TRNG peripherals.
///
/// # Example
///
/// ```ignore
/// async fn generate_nonce<R: RngHal>(rng: &mut R) -> Result<[u8; 16], HalError> {
/// let mut buf = [0u8; 16];
/// rng.fill_bytes(&mut buf).await?;
/// Ok(buf)
/// }
/// ```