Remove BootFlash borrow
Compiler will infer a different lifetime for BootFlash than for the borrowed flash, which makes it require more type annotations than if it was just owning the type. Since it doesn't really matter if it owns or borrows in practical use, change it to own so that it simplifies usage.
This commit is contained in:
@ -20,10 +20,9 @@ fn main() -> ! {
|
||||
*/
|
||||
|
||||
let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
|
||||
let mut flash = Flash::unlock(p.FLASH);
|
||||
let start = bl.prepare(&mut SingleFlashConfig::new(
|
||||
&mut BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(&mut flash),
|
||||
));
|
||||
let flash = Flash::unlock(p.FLASH);
|
||||
let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
|
||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||
core::mem::drop(flash);
|
||||
unsafe { bl.load(start) }
|
||||
}
|
||||
|
Reference in New Issue
Block a user