@@ -77,33 +77,32 @@ impl Debug for Seed {
7777 }
7878}
7979
80- /// A wrapper around 64 bits of data that can be constructed from any of the
81- /// following:
80+ /// A wrapper for `stream_id` (64-bits).
81+ ///
82+ /// Can be constructed from any of the following:
8283/// * `u64`
8384/// * `[u32; 2]`
8485/// * `[u8; 8]`
8586///
86- /// The arrays should be in little endian order. You should not need to use
87- /// this directly, as the methods in this crate that use this type call
88- /// `.into()` for you, so you only need to supply any of the above types.
89- pub struct U32x2 ( [ u32 ; Self :: LEN ] ) ;
87+ /// The arrays should be in little endian order.
88+ pub struct StreamId ( [ u32 ; Self :: LEN ] ) ;
9089
91- impl U32x2 {
92- /// Amount of raw bytes backing a `U32x2 ` instance.
90+ impl StreamId {
91+ /// Amount of raw bytes backing a `StreamId ` instance.
9392 const BYTES : usize = size_of :: < Self > ( ) ;
9493
95- /// The length of the array contained within `U32x2 `.
94+ /// The length of the array contained within `StreamId `.
9695 const LEN : usize = 2 ;
9796}
9897
99- impl From < [ u32 ; Self :: LEN ] > for U32x2 {
98+ impl From < [ u32 ; Self :: LEN ] > for StreamId {
10099 #[ inline]
101100 fn from ( value : [ u32 ; Self :: LEN ] ) -> Self {
102101 Self ( value)
103102 }
104103}
105104
106- impl From < [ u8 ; Self :: BYTES ] > for U32x2 {
105+ impl From < [ u8 ; Self :: BYTES ] > for StreamId {
107106 #[ inline]
108107 fn from ( value : [ u8 ; Self :: BYTES ] ) -> Self {
109108 let mut result = Self ( Default :: default ( ) ) ;
@@ -118,34 +117,14 @@ impl From<[u8; Self::BYTES]> for U32x2 {
118117 }
119118}
120119
121- impl From < u64 > for U32x2 {
120+ impl From < u64 > for StreamId {
122121 #[ inline]
123122 fn from ( value : u64 ) -> Self {
124123 let result: [ u8 ; Self :: BYTES ] = value. to_le_bytes ( ) [ ..Self :: BYTES ] . try_into ( ) . unwrap ( ) ;
125124 result. into ( )
126125 }
127126}
128127
129- /// A wrapper for `stream_id`.
130- ///
131- /// Can be constructed from any of the following:
132- /// * `u64`
133- /// * `[u32; 2]`
134- /// * `[u8; 8]`
135- ///
136- /// The arrays should be in little endian order.
137- pub type StreamId = U32x2 ;
138-
139- /// A wrapper for `block_pos`.
140- ///
141- /// Can be constructed from any of the following:
142- /// * `u64`
143- /// * `[u32; 2]`
144- /// * `[u8; 8]`
145- ///
146- /// The arrays should be in little endian order.
147- pub type BlockPos = U32x2 ;
148-
149128const BUFFER_SIZE : usize = 64 ;
150129
151130// NB. this must remain consistent with some currently hard-coded numbers in this module
0 commit comments