@@ -82,9 +82,10 @@ impl Debug for Seed {
8282 }
8383}
8484
85- /// A wrapper for set_word_pos() input that can be assembled from:
86- /// * `u64`
85+ /// A wrapper for set_word_pos() input.
86+ /// Can be constructed from any of the following:
8787/// * `[u8; 5]`
88+ /// * `u64`
8889pub struct WordPosInput {
8990 block_pos : u32 ,
9091 index : usize ,
@@ -113,7 +114,7 @@ const STREAM_ID_BYTES: usize = size_of::<StreamId>();
113114/// The length of the array contained within `StreamId`.
114115const STREAM_ID_LEN : usize = 3 ;
115116
116- /// A wrapper for the `stream_id`.
117+ /// A wrapper for `stream_id`.
117118/// Can be constructed from any of the following:
118119/// * `[u32; 3]`
119120/// * `[u8; 12]`
@@ -132,12 +133,12 @@ impl From<[u8; STREAM_ID_BYTES]> for StreamId {
132133 #[ inline]
133134 fn from ( value : [ u8 ; STREAM_ID_BYTES ] ) -> Self {
134135 let mut result = Self ( Default :: default ( ) ) ;
135- for ( n , chunk) in result
136+ for ( cur , chunk) in result
136137 . 0
137138 . iter_mut ( )
138139 . zip ( value. chunks_exact ( size_of :: < u32 > ( ) ) )
139140 {
140- * n = u32:: from_le_bytes ( chunk. try_into ( ) . unwrap ( ) ) . to_le ( ) ;
141+ * cur = u32:: from_le_bytes ( chunk. try_into ( ) . unwrap ( ) ) . to_le ( ) ;
141142 }
142143 result
143144 }
@@ -152,18 +153,21 @@ impl From<u128> for StreamId {
152153 }
153154}
154155
155- /// A wrapper for `block_pos`. It can be used with:
156- /// * u32
157- /// * [u8; 4]
156+ /// A wrapper for `block_pos`.
157+ /// Can be constructed from any of the following:
158+ /// * `[u8; 4]`
159+ /// * `u32`
158160pub struct BlockPos ( u32 ) ;
159161
160162impl From < u32 > for BlockPos {
163+ #[ inline]
161164 fn from ( value : u32 ) -> Self {
162165 Self ( value. to_le ( ) )
163166 }
164167}
165168
166169impl From < [ u8 ; 4 ] > for BlockPos {
170+ #[ inline]
167171 fn from ( value : [ u8 ; 4 ] ) -> Self {
168172 Self ( u32:: from_le_bytes ( value) . to_le ( ) )
169173 }
@@ -425,7 +429,7 @@ macro_rules! impl_chacha_rng {
425429 }
426430
427431 /// Set the offset from the start of the stream, in 32-bit words. This method
428- /// takes either :
432+ /// takes any of the following :
429433 /// * `[u8; 5]`
430434 /// * `u64`
431435 ///
@@ -447,7 +451,7 @@ macro_rules! impl_chacha_rng {
447451 ///
448452 /// The word pos will be equal to `block_pos * 16 words per block`.
449453 ///
450- /// This can be used with either :
454+ /// This method takes any of the following :
451455 /// * `[u8; 4]`
452456 /// * `u32`
453457 #[ inline]
@@ -463,7 +467,7 @@ macro_rules! impl_chacha_rng {
463467 }
464468
465469 /// Set the stream number. The lower 96 bits are used and the rest are
466- /// discarded. This method takes either :
470+ /// discarded. This method takes any of the following :
467471 /// * `[u32; 3]`
468472 /// * `[u8; 12]`
469473 /// * `u128`
0 commit comments