nil_core/city/
stability.rs1use derive_more::{Deref, Into};
5use serde::{Deserialize, Serialize};
6
7#[derive(Clone, Copy, Debug, Deref, Into, Deserialize, Serialize)]
9pub struct Stability(f64);
10
11impl Stability {
12 pub const MIN: Stability = Stability(0.0);
13 pub const MAX: Stability = Stability(1.0);
14
15 #[inline]
16 pub const fn new(value: f64) -> Self {
17 Self(value.clamp(Self::MIN.0, Self::MAX.0))
18 }
19}
20
21impl Default for Stability {
22 fn default() -> Self {
23 Self::MAX
24 }
25}