pub struct Float32(/* private fields */);Expand description
Finite canonical f32 atom.
Implementations§
Source§impl Float32
impl Float32
Sourcepub fn try_new(value: f32) -> Option<Self>
pub fn try_new(value: f32) -> Option<Self>
Construct a finite float and normalize negative zero.
Sourcepub const fn to_be_bytes(&self) -> [u8; 4]
pub const fn to_be_bytes(&self) -> [u8; 4]
Return the stable big-endian IEEE-754 representation.
Sourcepub fn try_from_bytes(bytes: &[u8]) -> Result<Self, Float32DecodeError>
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self, Float32DecodeError>
Decode one stable big-endian IEEE-754 representation.
§Errors
Returns a typed error for the wrong byte length or a non-finite value.
Sourcepub fn try_from_f64(value: f64) -> Option<Self>
pub fn try_from_f64(value: f64) -> Option<Self>
Convert a finite, in-range f64.
Trait Implementations§
Source§impl CandidType for Float32
impl CandidType for Float32
impl Copy for Float32
Source§impl<'de> Deserialize<'de> for Float32
impl<'de> Deserialize<'de> for Float32
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
impl Eq for Float32
Source§impl NumericValue for Float32
impl NumericValue for Float32
Source§fn try_to_decimal(&self) -> Option<Decimal>
fn try_to_decimal(&self) -> Option<Decimal>
Convert this value into
Decimal for generic numeric handling.Source§fn try_from_decimal(value: Decimal) -> Option<Self>
fn try_from_decimal(value: Decimal) -> Option<Self>
Rebuild the value from
Decimal after generic numeric handling.Source§impl Ord for Float32
impl Ord for Float32
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Float32
impl PartialOrd for Float32
Auto Trait Implementations§
impl Freeze for Float32
impl RefUnwindSafe for Float32
impl Send for Float32
impl Sync for Float32
impl Unpin for Float32
impl UnsafeUnpin for Float32
impl UnwindSafe for Float32
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