pub struct Rng { /* private fields */ }
Expand description
Random Generator.
If the rand_trait
feature is enabled, it implements the rand_core::RngCore
and rand_core::CryptoRng
traits.
§Sample usage
use linux_kcapi::{RngType, Rng};
let rng = Rng::new(RngType::DrbgPrHmacSha256, &seed)?;
rng.get_bytes(&mut data)?;
assert_ne!(zero, data);
rng.get_bytes(&mut data2)?;
assert_ne!(data, data2);
Implementations§
Trait Implementations§
Source§impl RngCore for Rng
Only available with "rand_trait"
feature
impl RngCore for Rng
Only available with "rand_trait"
feature
§Panic
next_u32
, next_u64
and fill_bytes
will panic in case of error
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moreimpl CryptoRng for Rng
Only available with "rand_trait"
feature
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnwindSafe for Rng
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore
trait object.