Module le

Module le 

Source
Expand description

§Little-Endian utilities

For cross-platform reproducibility, Little-Endian order (least-significant part first) has been chosen as the standard for inter-type conversion. For example, ``next_u64_via_u32] takes u32valuesx, y, then outputs (y << 32) | x`.

Byte-swapping (like the std to_le functions) is only needed to convert to/from byte sequences, and since its purpose is reproducibility, non-reproducible sources (e.g. OsRng) need not bother with it.

§Implementing RngCore

Usually an implementation of RngCore will implement one of the three methods over its internal source. The following helpers are provided for the remaining implementations.

fn next_u32:

fn next_u64:

fn fill_bytes:

§Implementing SeedableRng

In many cases, SeedableRng::Seed must be converted to [u32] or [u64]. The following helpers are provided:

Functions§

fill_bytes_via_next
Implement fill_bytes via next_u64 and next_u32, little-endian order.
next_u32_via_fill
Implement next_u32 via fill_bytes, little-endian order.
next_u64_via_fill
Implement next_u64 via fill_bytes, little-endian order.
next_u64_via_u32
Implement next_u64 via next_u32, little-endian order.
read_u32_into
Fills dst: &mut [u32] from src
read_u64_into
Fills dst: &mut [u64] from src