@@ -227,7 +227,7 @@ pub async fn peek<'d, S: NorFlash>(
227
227
let next_value = iterator. next ( data_buffer) . await ?;
228
228
229
229
match next_value {
230
- Some ( entry) => Ok ( Some ( entry. into_data ( ) ) ) ,
230
+ Some ( entry) => Ok ( Some ( entry. into_buf ( ) ) ) ,
231
231
None => Ok ( None ) ,
232
232
}
233
233
}
@@ -464,20 +464,16 @@ impl<'s, 'd, 'q, S: NorFlash, CI: CacheImpl> Deref for QueueIteratorEntry<'s, 'd
464
464
}
465
465
}
466
466
467
- impl < ' s , ' d , ' q , S : NorFlash , CI : CacheImpl > QueueIteratorEntry < ' s , ' d , ' q , S , CI > {
468
- /// Get a mutable reference to the data of this entry
469
- pub fn data_mut ( & mut self ) -> & mut [ u8 ] {
467
+ impl < ' s , ' d , ' q , S : NorFlash , CI : CacheImpl > DerefMut for QueueIteratorEntry < ' s , ' d , ' q , S , CI > {
468
+ fn deref_mut ( & mut self ) -> & mut Self :: Target {
470
469
self . item . data_mut ( )
471
470
}
471
+ }
472
472
473
- /// Get a reference to the data of this entry
474
- pub fn data ( & self ) -> & [ u8 ] {
475
- self . item . data ( )
476
- }
477
-
473
+ impl < ' s , ' d , ' q , S : NorFlash , CI : CacheImpl > QueueIteratorEntry < ' s , ' d , ' q , S , CI > {
478
474
/// Get a mutable reference to the data of this entry, but consume the entry too.
479
- /// This function has some relaxed lifetime constraints compared to [Self::data_mut] .
480
- pub fn into_data ( self ) -> & ' d mut [ u8 ] {
475
+ /// This function has some relaxed lifetime constraints compared to the deref impls .
476
+ pub fn into_buf ( self ) -> & ' d mut [ u8 ] {
481
477
let ( header, data) = self . item . destruct ( ) ;
482
478
& mut data[ ..header. length as usize ]
483
479
}
@@ -987,7 +983,7 @@ mod tests {
987
983
. await
988
984
. unwrap( )
989
985
. unwrap( )
990
- . data ( ) ,
986
+ . deref ( ) ,
991
987
& data[ ..] ,
992
988
"At {i}"
993
989
) ;
@@ -1043,7 +1039,7 @@ mod tests {
1043
1039
. await
1044
1040
. unwrap( )
1045
1041
. unwrap( )
1046
- . data ( ) ,
1042
+ . deref ( ) ,
1047
1043
& data,
1048
1044
"At {i}"
1049
1045
) ;
0 commit comments