mirror of
https://github.com/hannobraun/Fornjot
synced 2025-11-10 09:00:02 +00:00
Remove unused code
This commit is contained in:
parent
da46baa209
commit
0cf9f07867
@ -15,13 +15,11 @@ mod camera;
|
||||
mod graphics;
|
||||
mod input;
|
||||
mod screen;
|
||||
mod status_report;
|
||||
mod viewer;
|
||||
|
||||
pub use self::{
|
||||
graphics::RendererInitError,
|
||||
input::InputEvent,
|
||||
screen::{NormalizedScreenPosition, Screen, ScreenSize},
|
||||
status_report::StatusReport,
|
||||
viewer::Viewer,
|
||||
};
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
//! Struct to store and update status messages
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use chrono::Local;
|
||||
|
||||
/// Struct to store and update status messages
|
||||
#[derive(Default)]
|
||||
pub struct StatusReport {
|
||||
status: VecDeque<String>,
|
||||
}
|
||||
|
||||
impl StatusReport {
|
||||
/// Create a new `StatusReport` instance with a blank status
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Update the status
|
||||
pub fn update_status(&mut self, status: &str) {
|
||||
let date = {
|
||||
let date = Local::now();
|
||||
format!("{}", date.format("[%H:%M:%S.%3f]"))
|
||||
};
|
||||
let empty_space = " ".repeat(date.chars().count());
|
||||
|
||||
let mut rendered = String::new();
|
||||
for (i, line) in status.lines().enumerate() {
|
||||
let prefix = if i == 0 { &date } else { &empty_space };
|
||||
rendered.push_str(&format!("\n{prefix} {line}"));
|
||||
}
|
||||
|
||||
self.status.push_back(rendered);
|
||||
if self.status.len() > 5 {
|
||||
for _ in 0..(self.status.len() - 5) {
|
||||
self.status.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get current status
|
||||
pub fn status(&self) -> String {
|
||||
self.status
|
||||
.iter()
|
||||
.map(std::string::ToString::to_string)
|
||||
.collect::<String>()
|
||||
}
|
||||
|
||||
/// Reset status
|
||||
pub fn clear_status(&mut self) {
|
||||
self.status.clear();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user