Skip to content

Commit 216bf15

Browse files
Treehugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "Add a footer to the Debug store" into main
2 parents 3b2e421 + c00dcd6 commit 216bf15

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

libs/debugstore/rust/src/core.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl DebugStore {
4848
///
4949
/// This constant is used as a part of the debug store's data format,
5050
/// allowing for version tracking and compatibility checks.
51-
const ENCODE_VERSION: u32 = 2;
51+
const ENCODE_VERSION: u32 = 3;
5252

5353
/// Creates a new instance of `DebugStore` with specified event limit and maximum delay.
5454
fn new() -> Self {
@@ -123,9 +123,11 @@ impl DebugStore {
123123

124124
impl fmt::Display for DebugStore {
125125
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
126+
// Write the debug store header information
126127
let uptime_now = uptimeMillis();
127128
write!(f, "{},{},{}::", Self::ENCODE_VERSION, self.event_store.len(), uptime_now)?;
128129

130+
// Join events with a separator
129131
write!(
130132
f,
131133
"{}",
@@ -136,7 +138,10 @@ impl fmt::Display for DebugStore {
136138
acc.push_str(&event.to_string());
137139
acc
138140
})
139-
)
141+
)?;
142+
143+
// Write the debug store footer
144+
write!(f, ";;")
140145
}
141146
}
142147

0 commit comments

Comments
 (0)