Files
Dan Gohman 0c39924cef Rename crate::imp to crate::backend.
This aligns the module name with how all the comments and documentation
talk about it.

This is an internal API, so it's not a semver bump.

Fixes #367.
2022-07-02 15:18:43 -07:00

22 lines
657 B
Rust

use crate::{backend, io};
/// `GRND_*`
pub use backend::rand::types::GetRandomFlags;
/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
///
/// This is a very low-level API which may be difficult to use correctly. Most
/// users should prefer to use [`getrandom`] or [`rand`] APIs instead.
///
/// [`getrandom`]: https://crates.io/crates/getrandom
/// [`rand`]: https://crates.io/crates/rand
///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/getrandom.2.html
#[inline]
pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
backend::rand::syscalls::getrandom(buf, flags)
}