@@ -149,7 +149,7 @@ pub struct Ota<'a, F>
149149where
150150 F : embedded_storage:: Storage ,
151151{
152- flash : & ' a mut FlashRegion < ' a , F > ,
152+ flash : FlashRegion < ' a , F > ,
153153 ota_partition_count : usize ,
154154}
155155
@@ -165,10 +165,7 @@ where
165165 /// doesn't represent a Data/Ota partition or the size is unexpected.
166166 ///
167167 /// [Error::InvalidArgument] if the `ota_partition_count` exceeds the maximum or if it's 0.
168- pub fn new (
169- flash : & ' a mut FlashRegion < ' a , F > ,
170- ota_partition_count : usize ,
171- ) -> Result < Ota < ' a , F > , Error > {
168+ pub fn new ( flash : FlashRegion < ' a , F > , ota_partition_count : usize ) -> Result < Ota < ' a , F > , Error > {
172169 if ota_partition_count == 0 || ota_partition_count > 16 {
173170 return Err ( Error :: InvalidArgument ) ;
174171 }
@@ -432,12 +429,12 @@ mod tests {
432429 data : [ 0xff ; 0x2000 ] ,
433430 } ;
434431
435- let mut mock_region = FlashRegion {
432+ let mock_region = FlashRegion {
436433 raw : mock_entry,
437434 flash : & mut mock_flash,
438435 } ;
439436
440- let mut sut = Ota :: new ( & mut mock_region, 2 ) . unwrap ( ) ;
437+ let mut sut = Ota :: new ( mock_region, 2 ) . unwrap ( ) ;
441438 assert_eq ! (
442439 sut. current_app_partition( ) . unwrap( ) ,
443440 AppPartitionSubType :: Factory
@@ -482,12 +479,12 @@ mod tests {
482479 mock_flash. data [ 0x0000 ..] [ ..0x20 ] . copy_from_slice ( SLOT_COUNT_1_VALID ) ;
483480 mock_flash. data [ 0x1000 ..] [ ..0x20 ] . copy_from_slice ( SLOT_INITIAL ) ;
484481
485- let mut mock_region = FlashRegion {
482+ let mock_region = FlashRegion {
486483 raw : mock_entry,
487484 flash : & mut mock_flash,
488485 } ;
489486
490- let mut sut = Ota :: new ( & mut mock_region, 2 ) . unwrap ( ) ;
487+ let mut sut = Ota :: new ( mock_region, 2 ) . unwrap ( ) ;
491488 assert_eq ! (
492489 sut. current_app_partition( ) . unwrap( ) ,
493490 AppPartitionSubType :: Ota0
@@ -522,12 +519,12 @@ mod tests {
522519 mock_flash. data [ 0x0000 ..] [ ..0x20 ] . copy_from_slice ( SLOT_COUNT_1_VALID ) ;
523520 mock_flash. data [ 0x1000 ..] [ ..0x20 ] . copy_from_slice ( SLOT_COUNT_2_NEW ) ;
524521
525- let mut mock_region = FlashRegion {
522+ let mock_region = FlashRegion {
526523 raw : mock_entry,
527524 flash : & mut mock_flash,
528525 } ;
529526
530- let mut sut = Ota :: new ( & mut mock_region, 2 ) . unwrap ( ) ;
527+ let mut sut = Ota :: new ( mock_region, 2 ) . unwrap ( ) ;
531528 assert_eq ! (
532529 sut. current_app_partition( ) . unwrap( ) ,
533530 AppPartitionSubType :: Ota1
@@ -560,12 +557,12 @@ mod tests {
560557 data : [ 0xff ; 0x2000 ] ,
561558 } ;
562559
563- let mut mock_region = FlashRegion {
560+ let mock_region = FlashRegion {
564561 raw : mock_entry,
565562 flash : & mut mock_flash,
566563 } ;
567564
568- let mut sut = Ota :: new ( & mut mock_region, 2 ) . unwrap ( ) ;
565+ let mut sut = Ota :: new ( mock_region, 2 ) . unwrap ( ) ;
569566 assert_eq ! (
570567 sut. current_app_partition( ) . unwrap( ) ,
571568 AppPartitionSubType :: Factory
@@ -626,12 +623,12 @@ mod tests {
626623 data : [ 0xff ; 0x2000 ] ,
627624 } ;
628625
629- let mut mock_region = FlashRegion {
626+ let mock_region = FlashRegion {
630627 raw : mock_entry,
631628 flash : & mut mock_flash,
632629 } ;
633630
634- let mut sut = Ota :: new ( & mut mock_region, 4 ) . unwrap ( ) ;
631+ let mut sut = Ota :: new ( mock_region, 4 ) . unwrap ( ) ;
635632 assert_eq ! (
636633 sut. current_app_partition( ) . unwrap( ) ,
637634 AppPartitionSubType :: Factory
@@ -711,12 +708,12 @@ mod tests {
711708 data : [ 0xff ; 0x2000 ] ,
712709 } ;
713710
714- let mut mock_region = FlashRegion {
711+ let mock_region = FlashRegion {
715712 raw : mock_entry,
716713 flash : & mut mock_flash,
717714 } ;
718715
719- let mut sut = Ota :: new ( & mut mock_region, 16 ) . unwrap ( ) ;
716+ let mut sut = Ota :: new ( mock_region, 16 ) . unwrap ( ) ;
720717 assert_eq ! (
721718 sut. current_app_partition( ) . unwrap( ) ,
722719 AppPartitionSubType :: Factory
0 commit comments