Struct Real
pub struct Real { /* private fields */ }Expand description
A validated finite f64 value.
Implementations§
§impl Real
impl Real
pub const fn try_new(value: f64) -> Result<Real, RealError>
pub const fn try_new(value: f64) -> Result<Real, RealError>
Creates a real value from a finite f64.
§Errors
Returns RealError::NonFiniteValue when value is NaN or
infinite.
§Examples
use use_real::{Real, RealError};
let real = Real::try_new(2.5)?;
assert_eq!(real, Real::new(2.5));
assert!(matches!(
Real::try_new(f64::INFINITY),
Err(RealError::NonFiniteValue { .. })
));Trait Implementations§
§impl PartialOrd for Real
impl PartialOrd for Real
impl Copy for Real
impl StructuralPartialEq for Real
Auto Trait Implementations§
impl Freeze for Real
impl RefUnwindSafe for Real
impl Send for Real
impl Sync for Real
impl Unpin for Real
impl UnsafeUnpin for Real
impl UnwindSafe for Real
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