@@ -203,7 +203,7 @@ impl QueueFile {
203203 if force_legacy {
204204 buf. put_u32 ( capacity as u32 ) ;
205205 } else {
206- buf. put_u32 ( QueueFile :: VERSIONED_HEADER ) ;
206+ buf. put_u32 ( Self :: VERSIONED_HEADER ) ;
207207 buf. put_u64 ( capacity) ;
208208 }
209209
@@ -225,7 +225,7 @@ impl QueueFile {
225225 /// # let path = auto_delete_path::AutoDeletePath::temp();
226226 /// let qf = QueueFile::with_capacity(path, 120).expect("failed to open queue");
227227 /// ```
228- pub fn with_capacity < P : AsRef < Path > > ( path : P , capacity : u64 ) -> Result < QueueFile > {
228+ pub fn with_capacity < P : AsRef < Path > > ( path : P , capacity : u64 ) -> Result < Self > {
229229 Self :: open_internal ( path, true , false , capacity)
230230 }
231231
@@ -238,8 +238,8 @@ impl QueueFile {
238238 /// # let path = auto_delete_path::AutoDeletePath::temp();
239239 /// let qf = QueueFile::open(path).expect("failed to open queue");
240240 /// ```
241- pub fn open < P : AsRef < Path > > ( path : P ) -> Result < QueueFile > {
242- Self :: with_capacity ( path, QueueFile :: INITIAL_LENGTH )
241+ pub fn open < P : AsRef < Path > > ( path : P ) -> Result < Self > {
242+ Self :: with_capacity ( path, Self :: INITIAL_LENGTH )
243243 }
244244
245245 /// Open or create [QueueFile] at `path` forcing legacy format.
@@ -251,15 +251,15 @@ impl QueueFile {
251251 /// # let path = auto_delete_path::AutoDeletePath::temp();
252252 /// let qf = QueueFile::open_legacy(path).expect("failed to open queue");
253253 /// ```
254- pub fn open_legacy < P : AsRef < Path > > ( path : P ) -> Result < QueueFile > {
255- Self :: open_internal ( path, true , true , QueueFile :: INITIAL_LENGTH )
254+ pub fn open_legacy < P : AsRef < Path > > ( path : P ) -> Result < Self > {
255+ Self :: open_internal ( path, true , true , Self :: INITIAL_LENGTH )
256256 }
257257
258258 fn open_internal < P : AsRef < Path > > (
259259 path : P , overwrite_on_remove : bool , force_legacy : bool , capacity : u64 ,
260- ) -> Result < QueueFile > {
260+ ) -> Result < Self > {
261261 if !path. as_ref ( ) . exists ( ) {
262- QueueFile :: init ( path. as_ref ( ) , force_legacy, capacity) ?;
262+ Self :: init ( path. as_ref ( ) , force_legacy, capacity) ?;
263263 }
264264
265265 let mut file = OpenOptions :: new ( ) . read ( true ) . write ( true ) . open ( path) ?;
@@ -327,7 +327,7 @@ impl QueueFile {
327327 msg: format!( "position of the last element ({last_pos}) is beyond the file" )
328328 } ) ;
329329
330- let mut queue_file = QueueFile {
330+ let mut queue_file = Self {
331331 inner : QueueFileInner {
332332 file : ManuallyDrop :: new ( file) ,
333333 file_len,
@@ -668,15 +668,15 @@ impl QueueFile {
668668 if self . overwrite_on_remove {
669669 self . inner . seek ( self . header_len ) ?;
670670 let first_block = self . capacity . min ( Self :: BLOCK_LENGTH ) - self . header_len ;
671- self . inner . write ( & QueueFile :: ZEROES [ ..first_block as usize ] ) ?;
671+ self . inner . write ( & Self :: ZEROES [ ..first_block as usize ] ) ?;
672672
673673 if let Some ( left) = self . capacity . checked_sub ( Self :: BLOCK_LENGTH ) {
674674 for _ in 0 ..left / Self :: BLOCK_LENGTH {
675- self . inner . write ( & QueueFile :: ZEROES ) ?;
675+ self . inner . write ( & Self :: ZEROES ) ?;
676676 }
677677 let tail = left % Self :: BLOCK_LENGTH ;
678678 if tail != 0 {
679- self . inner . write ( & QueueFile :: ZEROES [ ..tail as usize ] ) ?;
679+ self . inner . write ( & Self :: ZEROES [ ..tail as usize ] ) ?;
680680 }
681681 }
682682 }
@@ -784,7 +784,7 @@ impl QueueFile {
784784 assert ! ( first_pos <= i64 :: max_value( ) as u64 ) ;
785785 assert ! ( last_pos <= i64 :: max_value( ) as u64 ) ;
786786
787- header_buf. put_u32 ( QueueFile :: VERSIONED_HEADER ) ;
787+ header_buf. put_u32 ( Self :: VERSIONED_HEADER ) ;
788788 header_buf. put_u64 ( file_len) ;
789789 header_buf. put_i32 ( elem_cnt as i32 ) ;
790790 header_buf. put_u64 ( first_pos) ;
@@ -845,9 +845,9 @@ impl QueueFile {
845845 let mut len = n;
846846
847847 self . write_buf . clear ( ) ;
848- self . write_buf . extend ( QueueFile :: ZEROES ) ;
848+ self . write_buf . extend ( Self :: ZEROES ) ;
849849 while len > 0 {
850- let chunk_len = min ( len, QueueFile :: ZEROES . len ( ) ) ;
850+ let chunk_len = min ( len, Self :: ZEROES . len ( ) ) ;
851851 self . write_buf . truncate ( chunk_len) ;
852852
853853 self . ring_write_buf ( pos) ?;
@@ -1128,7 +1128,7 @@ struct Element {
11281128}
11291129
11301130impl Element {
1131- const EMPTY : Element = Element { pos : 0 , len : 0 } ;
1131+ const EMPTY : Self = Self { pos : 0 , len : 0 } ;
11321132 const HEADER_LENGTH : usize = 4 ;
11331133
11341134 fn new ( pos : u64 , len : usize ) -> Self {
@@ -1143,7 +1143,7 @@ impl Element {
11431143 i32 :: max_value( )
11441144 ) ;
11451145
1146- Element { pos, len }
1146+ Self { pos, len }
11471147 }
11481148}
11491149
0 commit comments