pub struct AreaKm2(/* private fields */);Expand description
A catchment area expressed in square kilometres.
Invariant: the wrapped value is always finite and non-negative.
Eq is intentionally not derived — deriving Eq on f32 is a Rust
footgun because IEEE-754 NaN != NaN. The constructor ensures the value is
finite, but the derive would still be misleading. Use PartialEq directly
or compare via AreaKm2::get.
Implementations§
Source§impl AreaKm2
impl AreaKm2
Sourcepub fn new(raw: f32) -> Result<Self, MeasureError>
pub fn new(raw: f32) -> Result<Self, MeasureError>
Construct an AreaKm2 from a raw f32.
§Errors
| Condition | Error variant |
|---|---|
raw is NaN or infinite | MeasureError::NonFiniteValue |
raw < 0.0 | MeasureError::NegativeValue |
Trait Implementations§
impl Copy for AreaKm2
Source§impl PartialOrd for AreaKm2
impl PartialOrd for AreaKm2
impl StructuralPartialEq for AreaKm2
Auto Trait Implementations§
impl Freeze for AreaKm2
impl RefUnwindSafe for AreaKm2
impl Send for AreaKm2
impl Sync for AreaKm2
impl Unpin for AreaKm2
impl UnsafeUnpin for AreaKm2
impl UnwindSafe for AreaKm2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more