Struct RngReadAdapter

struct RngReadAdapter<'a, R: TryRngCore + ?Sized> { ... }

Adapter that enables reading through a io::Read from a RngCore.

Examples

# use std::{io, io::Read};
# use std::fs::File;
# use rand_core::{OsRng, TryRngCore};

io::copy(&mut OsRng.read_adapter().take(100), &mut File::create("/tmp/random.bytes").unwrap()).unwrap();

Implementations

impl<'a, R> Freeze for RngReadAdapter<'a, R>

impl<'a, R> RefUnwindSafe for RngReadAdapter<'a, R>

impl<'a, R> Send for RngReadAdapter<'a, R>

impl<'a, R> Sync for RngReadAdapter<'a, R>

impl<'a, R> Unpin for RngReadAdapter<'a, R>

impl<'a, R> UnsafeUnpin for RngReadAdapter<'a, R>

impl<'a, R> UnwindSafe for RngReadAdapter<'a, R>

impl<R: TryRngCore + ?Sized> Debug for RngReadAdapter<'_, R>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<R: TryRngCore + ?Sized> Read for RngReadAdapter<'_, R>

fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize, Error>

impl<T> Any for RngReadAdapter<'a, R>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for RngReadAdapter<'a, R>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for RngReadAdapter<'a, R>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for RngReadAdapter<'a, R>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for RngReadAdapter<'a, R>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for RngReadAdapter<'a, R>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for RngReadAdapter<'a, R>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>