Struct SysRng
pub struct SysRng;
A TryRng interface over the system's preferred random number source
This is a zero-sized struct. It can be freely constructed with just SysRng.
This struct is also available as rand::rngs::SysRng when using rand.
Usage example
SysRng implements [TryRng]:
use ;
let mut key = ;
SysRng.try_fill_bytes.unwrap;
Using it as an Rng is possible using UnwrapErr:
use ;
use SysRng;
let mut rng = UnwrapErr;
let random_u64 = rng.next_u64;
Trait Implementations
impl Clone for SysRng
fn clone(&self) -> SysRng
impl Copy for SysRng
impl Debug for SysRng
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for SysRng
fn default() -> SysRng
impl TryCryptoRng for SysRng
impl TryRng for SysRng
type Error = Error;fn try_next_u32(&mut self) -> Result<u32, Error>fn try_next_u64(&mut self) -> Result<u64, Error>fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>
Auto Trait Implementations
impl Freeze for SysRng
impl RefUnwindSafe for SysRng
impl Send for SysRng
impl Sync for SysRng
impl Unpin for SysRng
impl UnsafeUnpin for SysRng
impl UnwindSafe for SysRng
Blanket Implementations
impl<R> TryRngCore for SysRng
where
R: TryRng,
type Error = <R as TryRng>::Error;
impl<T> Any for SysRng
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SysRng
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SysRng
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for SysRng
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for SysRng
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for SysRng
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for SysRng
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SysRng
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for SysRng
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>