pub struct PositiveReal(/* private fields */);Expand description
A f64 value that is not +/- inf, nan, or a value <= 0.
§Example
use hoomd_utility::valid::PositiveReal;
let positive = PositiveReal::try_from(1.0)?;Implementations§
Trait Implementations§
Source§impl Clone for PositiveReal
impl Clone for PositiveReal
Source§fn clone(&self) -> PositiveReal
fn clone(&self) -> PositiveReal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PositiveReal
impl Debug for PositiveReal
Source§impl<'de> Deserialize<'de> for PositiveReal
impl<'de> Deserialize<'de> for PositiveReal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PositiveReal
impl Display for PositiveReal
Source§impl Div for PositiveReal
impl Div for PositiveReal
Source§impl DivAssign for PositiveReal
impl DivAssign for PositiveReal
Source§fn div_assign(&mut self, rhs: PositiveReal)
fn div_assign(&mut self, rhs: PositiveReal)
Performs the
/= operation. Read moreSource§impl Mul for PositiveReal
impl Mul for PositiveReal
Source§impl MulAssign for PositiveReal
impl MulAssign for PositiveReal
Source§fn mul_assign(&mut self, rhs: PositiveReal)
fn mul_assign(&mut self, rhs: PositiveReal)
Performs the
*= operation. Read moreSource§impl Ord for PositiveReal
impl Ord for PositiveReal
Source§impl PartialEq for PositiveReal
impl PartialEq for PositiveReal
Source§impl PartialOrd for PositiveReal
impl PartialOrd for PositiveReal
Source§impl Serialize for PositiveReal
impl Serialize for PositiveReal
Source§impl TryFrom<f64> for PositiveReal
impl TryFrom<f64> for PositiveReal
Source§fn try_from(v: f64) -> Result<PositiveReal, Error>
fn try_from(v: f64) -> Result<PositiveReal, Error>
Convert f64 to PositiveReal.
§Example
Valid conversion:
use hoomd_utility::valid::PositiveReal;
let positive = PositiveReal::try_from(1.0)?;Invalid conversion
use hoomd_utility::valid::PositiveReal;
let result = PositiveReal::try_from(-1.0);
assert!(matches!(
result,
Err(hoomd_utility::valid::Error::NotPositive(_))
));§Errors
Error::NotFinite when v is not finite.
Error::NotPositive when v is not a positive value
impl Copy for PositiveReal
impl Eq for PositiveReal
impl StructuralPartialEq for PositiveReal
Auto Trait Implementations§
impl Freeze for PositiveReal
impl RefUnwindSafe for PositiveReal
impl Send for PositiveReal
impl Sync for PositiveReal
impl Unpin for PositiveReal
impl UnwindSafe for PositiveReal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more