pub struct RngState {
pub seed: [u8; 32],
pub stream: u64,
pub word_pos: u128,
}Expand description
Serializable snapshot of a SeededRng’s position in its stream.
ChaCha20 is a counter-based stream cipher, so its entire state is the
256-bit seed, the 64-bit stream selector, and the 64-bit word position
within the keystream. Capturing those three reproduces the identical
subsequent draw sequence on SeededRng::restore.
Fields§
§seed: [u8; 32]The 32-byte ChaCha20 key/seed.
stream: u64Stream selector — distinguishes independent substreams produced by
SeededRng::split.
word_pos: u128Word position within the keystream (block counter * 16 + offset).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RngState
impl<'de> Deserialize<'de> for RngState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RngState
impl StructuralPartialEq for RngState
Auto Trait Implementations§
impl Freeze for RngState
impl RefUnwindSafe for RngState
impl Send for RngState
impl Sync for RngState
impl Unpin for RngState
impl UnsafeUnpin for RngState
impl UnwindSafe for RngState
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