sim: Move `Images` to before code
Rust convention is to have types before implementation. Move `Images`
up to the top to make it more prominent. This is also a good
opportunity to add a bit of a comment to this struct.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index e673807..bbb25a0 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -21,6 +21,18 @@
use crate::caps::Caps;
use crate::tlv::{ManifestGen, TlvGen, TlvFlags, AES_SEC_KEY};
+/// Images represents the state of a simulation for a given set of images.
+/// The flashmap holds the state of the simulated flash, whereas primaries
+/// and upgrades hold the expected contents of these images.
+pub struct Images {
+ pub flashmap: SimFlashMap,
+ pub areadesc: AreaDesc,
+ pub slots: [SlotInfo; 2],
+ pub primaries: [Option<Vec<u8>>; 2],
+ pub upgrades: [Option<Vec<u8>>; 2],
+ pub total_count: Option<i32>,
+}
+
impl Images {
/// A simple upgrade without forced failures.
///
@@ -957,15 +969,6 @@
pub dev_id: u8,
}
-pub struct Images {
- pub flashmap: SimFlashMap,
- pub areadesc: AreaDesc,
- pub slots: [SlotInfo; 2],
- pub primaries: [Option<Vec<u8>>; 2],
- pub upgrades: [Option<Vec<u8>>; 2],
- pub total_count: Option<i32>,
-}
-
const MAGIC: Option<&[u8]> = Some(&[0x77, 0xc2, 0x95, 0xf3,
0x60, 0xd2, 0xef, 0x7f,
0x35, 0x52, 0x50, 0x0f,