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
@@ -3,71 +3,71 @@ use std::collections::VecDeque;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct DiggingTask {
|
||||
path: VecDeque<(usize, usize)>,
|
||||
progress: f32,
|
||||
tick_increase: f32,
|
||||
total_steps: usize,
|
||||
path: VecDeque<(usize, usize)>,
|
||||
progress: f32,
|
||||
tick_increase: f32,
|
||||
total_steps: usize,
|
||||
}
|
||||
|
||||
impl DiggingTask {
|
||||
pub fn new(path: VecDeque<(usize, usize)>, tick_increase: f32) -> Self {
|
||||
Self {
|
||||
total_steps: path.len(),
|
||||
path,
|
||||
progress: 0.0,
|
||||
tick_increase,
|
||||
pub fn new(path: VecDeque<(usize, usize)>, tick_increase: f32) -> Self {
|
||||
Self {
|
||||
total_steps: path.len(),
|
||||
path,
|
||||
progress: 0.0,
|
||||
tick_increase,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pop_front(&mut self) {
|
||||
self.path.pop_front();
|
||||
self.progress = 0.0;
|
||||
}
|
||||
|
||||
pub fn from_moving(task: MovingTask, tick_increase: f32) -> Self {
|
||||
Self {
|
||||
path: task.get_path().clone(),
|
||||
progress: 0.0,
|
||||
tick_increase,
|
||||
total_steps: task.get_total_steps(),
|
||||
pub fn pop_front(&mut self) {
|
||||
self.path.pop_front();
|
||||
self.progress = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn current_target(&self) -> Option<(usize, usize)> {
|
||||
self.path.front().copied()
|
||||
}
|
||||
pub fn from_moving(task: MovingTask, tick_increase: f32) -> Self {
|
||||
Self {
|
||||
path: task.get_path().clone(),
|
||||
progress: 0.0,
|
||||
tick_increase,
|
||||
total_steps: task.get_total_steps(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn current_target(&self) -> Option<(usize, usize)> {
|
||||
self.path.front().copied()
|
||||
}
|
||||
}
|
||||
|
||||
impl Task for DiggingTask {
|
||||
fn get_icon(&self) -> char {
|
||||
'⛏'
|
||||
}
|
||||
fn get_icon(&self) -> char {
|
||||
'⛏'
|
||||
}
|
||||
|
||||
fn get_path(&self) -> &VecDeque<(usize, usize)> {
|
||||
&self.path
|
||||
}
|
||||
fn get_path(&self) -> &VecDeque<(usize, usize)> {
|
||||
&self.path
|
||||
}
|
||||
|
||||
fn get_path_front_coords(&self) -> &(usize, usize) {
|
||||
self.path.front().map_or(&(0, 0), |c| c)
|
||||
}
|
||||
fn get_path_front_coords(&self) -> &(usize, usize) {
|
||||
self.path.front().map_or(&(0, 0), |c| c)
|
||||
}
|
||||
|
||||
fn get_path_back_coords(&self) -> &(usize, usize) {
|
||||
self.path.back().map_or(&(0, 0), |c| c)
|
||||
}
|
||||
fn get_path_back_coords(&self) -> &(usize, usize) {
|
||||
self.path.back().map_or(&(0, 0), |c| c)
|
||||
}
|
||||
|
||||
fn get_progress(&self) -> f32 {
|
||||
self.progress
|
||||
}
|
||||
fn get_progress(&self) -> f32 {
|
||||
self.progress
|
||||
}
|
||||
|
||||
fn get_total_steps(&self) -> usize {
|
||||
self.total_steps
|
||||
}
|
||||
fn get_total_steps(&self) -> usize {
|
||||
self.total_steps
|
||||
}
|
||||
|
||||
fn progress(&mut self) {
|
||||
self.progress = (self.progress + self.tick_increase).clamp(0.0, 100.0);
|
||||
}
|
||||
fn progress(&mut self) {
|
||||
self.progress = (self.progress + self.tick_increase).clamp(0.0, 100.0);
|
||||
}
|
||||
|
||||
fn is_finished(&self) -> bool {
|
||||
self.progress >= 100.0
|
||||
}
|
||||
fn is_finished(&self) -> bool {
|
||||
self.progress >= 100.0
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user