Skip to content

Commit

Permalink
Store status as vector and add clear_status method
Browse files Browse the repository at this point in the history
  • Loading branch information
devanlooches authored and hannobraun committed Aug 8, 2022
1 parent 8607b44 commit ad16aa4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions crates/fj-interop/src/status_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
/// Struct to store and update status messages
pub struct StatusReport {
status: String,
status: Vec<String>,
}

impl StatusReport {
/// Create a new ``StatusReport`` instance with a blank status
pub fn new() -> Self {
Self {
status: String::new(),
}
Self { status: Vec::new() }
}

/// Update the status
pub fn update_status(&mut self, status: &str) {
self.status = status.to_string();
self.status.push(status.to_string());
}

/// Get current status
pub fn status(&self) -> &str {
self.status.as_str()
pub fn status(&self) -> String {
self.status.join("\n")
}

/// Reset status
pub fn clear_status(&mut self) {
self.status.clear();
}
}

Expand Down

0 comments on commit ad16aa4

Please sign in to comment.