hoomd_utility/valid/
mod.rs

1// Copyright (c) 2024-2026 The Regents of the University of Michigan.
2// Part of hoomd-rs, released under the BSD 3-Clause License.
3
4//! Ensure that values are in well-defined ranges.
5
6mod open_unit_interval_number;
7mod positive_real;
8
9use thiserror::Error;
10
11pub use open_unit_interval_number::OpenUnitIntervalNumber;
12pub use positive_real::PositiveReal;
13
14/// Enumerate possible sources of error in fallible validation methods.
15#[non_exhaustive]
16#[derive(Error, PartialEq, Debug)]
17pub enum Error {
18    /// A positive value greater than 0 is required.
19    #[error("{0} is not greater than 0")]
20    NotPositive(f64),
21
22    /// A finite value is required.
23    #[error("{0} is not finite")]
24    NotFinite(f64),
25
26    /// An value in (0,1) is required.
27    #[error("{0} is not in (0,1)")]
28    NotInOpenUnitInterval(f64),
29}