Struct bdk_chain::bitcoin::secp256k1::rand::rngs::adapter::ReadRng

source ยท
pub struct ReadRng<R> { /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.8.4: removal due to lack of usage
Expand description

An RNG that reads random bytes straight from any type supporting std::io::Read, for example files.

This will work best with an infinite reader, but that is not required.

This can be used with /dev/urandom on Unix but it is recommended to use OsRng instead.

ยงPanics

ReadRng uses std::io::Read::read_exact, which retries on interrupts. All other errors from the underlying reader, including when it does not have enough data, will only be reported through try_fill_bytes. The other RngCore methods will panic in case of an error.

Implementationsยง

sourceยง

impl<R> ReadRng<R>
where R: Read,

source

pub fn new(r: R) -> ReadRng<R>

Create a new ReadRng from a Read.

Trait Implementationsยง

sourceยง

impl<R> Debug for ReadRng<R>
where R: Debug,

sourceยง

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

Formats the value using the given formatter. Read more
sourceยง

impl<R> RngCore for ReadRng<R>
where R: Read,

sourceยง

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
sourceยง

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
sourceยง

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
sourceยง

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data. Read more

Auto Trait Implementationsยง

ยง

impl<R> Freeze for ReadRng<R>
where R: Freeze,

ยง

impl<R> RefUnwindSafe for ReadRng<R>
where R: RefUnwindSafe,

ยง

impl<R> Send for ReadRng<R>
where R: Send,

ยง

impl<R> Sync for ReadRng<R>
where R: Sync,

ยง

impl<R> Unpin for ReadRng<R>
where R: Unpin,

ยง

impl<R> UnwindSafe for ReadRng<R>
where R: UnwindSafe,

Blanket Implementationsยง

sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

sourceยง

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

Mutably borrows from an owned value. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

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

sourceยง

impl<R> Rng for R
where R: RngCore + ?Sized,

sourceยง

fn gen<T>(&mut self) -> T

Return a random value supporting the Standard distribution. Read more
sourceยง

fn gen_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
sourceยง

fn sample<T, D>(&mut self, distr: D) -> T
where D: Distribution<T>,

Sample a new value, using the given distribution. Read more
sourceยง

fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T> โ“˜
where D: Distribution<T>, Self: Sized,

Create an iterator that generates values using the given distribution. Read more
sourceยง

fn fill<T>(&mut self, dest: &mut T)
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
sourceยง

fn try_fill<T>(&mut self, dest: &mut T) -> Result<(), Error>
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
sourceยง

fn gen_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
sourceยง

fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of returning true. If numerator == denominator, then the returned value is guaranteed to be true. If numerator == 0, then the returned value is guaranteed to be false. Read more
sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

ยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

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

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

ยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

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

Performs the conversion.
ยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

ยง

fn vzip(self) -> V