File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ impl ObjectId {
148
148
hex:: encode ( self . id )
149
149
}
150
150
151
- // Generates a new timestamp representing the current seconds since epoch.
152
- // Represented in Big Endian.
151
+ /// Generates a new timestamp representing the current seconds since epoch.
152
+ /// Represented in Big Endian.
153
153
fn gen_timestamp ( ) -> [ u8 ; 4 ] {
154
154
let timestamp: u32 = SystemTime :: now ( )
155
155
. duration_since ( SystemTime :: UNIX_EPOCH )
@@ -160,22 +160,17 @@ impl ObjectId {
160
160
timestamp. to_be_bytes ( )
161
161
}
162
162
163
- // Generate a random 5-byte array.
163
+ /// Generate a random 5-byte array.
164
164
fn gen_process_id ( ) -> [ u8 ; 5 ] {
165
165
lazy_static ! {
166
- static ref BUF : [ u8 ; 5 ] = {
167
- let rng = thread_rng( ) . gen_range( 0 , MAX_U24 ) as u32 ;
168
- let mut buf: [ u8 ; 5 ] = [ 0 ; 5 ] ;
169
- buf[ 0 ..4 ] . copy_from_slice( & rng. to_be_bytes( ) ) ;
170
- buf
171
- } ;
166
+ static ref BUF : [ u8 ; 5 ] = thread_rng( ) . gen ( ) ;
172
167
}
173
168
174
169
* BUF
175
170
}
176
171
177
- // Gets an incremental 3-byte count.
178
- // Represented in Big Endian.
172
+ /// Gets an incremental 3-byte count.
173
+ /// Represented in Big Endian.
179
174
fn gen_count ( ) -> [ u8 ; 3 ] {
180
175
let u_counter = OID_COUNTER . fetch_add ( 1 , Ordering :: SeqCst ) ;
181
176
You can’t perform that action at this time.
0 commit comments