Improve factory generation
This commit is contained in:
parent
0f8bf5000c
commit
ec869d4c18
7 changed files with 107 additions and 46 deletions
|
|
@ -56,6 +56,20 @@ impl Beltspeed {
|
|||
}
|
||||
s
|
||||
}
|
||||
|
||||
pub fn from_items_per_second(x: f64) -> Self {
|
||||
if x <= 15.0 {
|
||||
Beltspeed::Normal
|
||||
} else if x <= 30.0 {
|
||||
Beltspeed::Fast
|
||||
} else if x <= 45.0 {
|
||||
Beltspeed::Express
|
||||
} else if x <= 60.0 {
|
||||
Beltspeed::Turbo
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue