generated from GarandPLG/rust-flake-template
Update formatting to use 4‑space indentation
- Adjust rustfmt.toml to set tab_spaces = 4. - Reformat imports, struct definitions, function bodies, and match arms across the project to match the new style (aligned fields, added spacing, etc.). - Ensure all code complies with the updated rustfmt settings.
This commit is contained in:
1 parent
a981663152
commit
73f544d5d6
66 files changed
+5378
-5373
No files matched your search
@@ -1,57 +1,57 @@
|
||||
use crate::app::states::skirmish_states::Players;
|
||||
use ratatui::{
|
||||
style::{Color, Stylize},
|
||||
text::Line,
|
||||
style::{Color, Stylize},
|
||||
text::Line,
|
||||
};
|
||||
|
||||
pub trait Structure {
|
||||
fn get_tag(&self) -> char;
|
||||
fn get_tag(&self) -> char;
|
||||
|
||||
fn get_color(&self) -> Color;
|
||||
fn get_color(&self) -> Color;
|
||||
|
||||
fn get_level(&self) -> char;
|
||||
fn get_level(&self) -> char;
|
||||
|
||||
fn get_stress(&self) -> u8;
|
||||
fn get_stress(&self) -> u8;
|
||||
|
||||
fn get_durability(&self) -> u16;
|
||||
fn get_durability(&self) -> u16;
|
||||
|
||||
fn get_max_durability(&self) -> u16;
|
||||
fn get_max_durability(&self) -> u16;
|
||||
|
||||
fn get_name(&self) -> &'static str;
|
||||
fn get_name(&self) -> &'static str;
|
||||
|
||||
fn get_owner(&self) -> Players;
|
||||
fn get_owner(&self) -> Players;
|
||||
|
||||
fn base_text(&self) -> Vec<Line<'_>> {
|
||||
let durability: u16 = self.get_durability();
|
||||
let max_durability: u16 = self.get_max_durability();
|
||||
let durability_percent: u32 = durability as u32 * 100 / max_durability as u32;
|
||||
let stress: u8 = self.get_stress();
|
||||
let level: char = self.get_level();
|
||||
fn base_text(&self) -> Vec<Line<'_>> {
|
||||
let durability: u16 = self.get_durability();
|
||||
let max_durability: u16 = self.get_max_durability();
|
||||
let durability_percent: u32 = durability as u32 * 100 / max_durability as u32;
|
||||
let stress: u8 = self.get_stress();
|
||||
let level: char = self.get_level();
|
||||
|
||||
let mut lines: Vec<Line<'_>> = vec![
|
||||
Line::from_iter([
|
||||
"Durability: ".gray(),
|
||||
durability.to_string().cyan(),
|
||||
"/".gray(),
|
||||
max_durability.to_string().cyan(),
|
||||
" ( ".gray(),
|
||||
durability_percent.to_string().cyan(),
|
||||
"% )".gray(),
|
||||
]),
|
||||
Line::from_iter(["Stress: ".gray(), stress.to_string().cyan(), "%".gray()]),
|
||||
];
|
||||
let mut lines: Vec<Line<'_>> = vec![
|
||||
Line::from_iter([
|
||||
"Durability: ".gray(),
|
||||
durability.to_string().cyan(),
|
||||
"/".gray(),
|
||||
max_durability.to_string().cyan(),
|
||||
" ( ".gray(),
|
||||
durability_percent.to_string().cyan(),
|
||||
"% )".gray(),
|
||||
]),
|
||||
Line::from_iter(["Stress: ".gray(), stress.to_string().cyan(), "%".gray()]),
|
||||
];
|
||||
|
||||
if level != ' ' {
|
||||
lines.push(Line::from_iter([
|
||||
"Level: ".gray(),
|
||||
level.to_string().cyan(),
|
||||
]));
|
||||
if level != ' ' {
|
||||
lines.push(Line::from_iter([
|
||||
"Level: ".gray(),
|
||||
level.to_string().cyan(),
|
||||
]));
|
||||
}
|
||||
|
||||
lines
|
||||
}
|
||||
|
||||
lines
|
||||
}
|
||||
|
||||
fn text(&self) -> Vec<Line<'_>> {
|
||||
self.base_text()
|
||||
}
|
||||
fn text(&self) -> Vec<Line<'_>> {
|
||||
self.base_text()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user