pub struct Float32(/* private fields */);Expand description
Finite canonical f32 atom.
Implementations§
Source§impl Float32
impl Float32
Sourcepub fn try_new(value: f32) -> Option<Float32>
pub fn try_new(value: f32) -> Option<Float32>
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<Float32, Float32DecodeError>
pub fn try_from_bytes(bytes: &[u8]) -> Result<Float32, 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<Float32>
pub fn try_from_f64(value: f64) -> Option<Float32>
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<Float32, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Float32, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Float32
Source§impl NormalizeAuto for Float32
impl NormalizeAuto for Float32
fn normalize_self(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NormalizeCustom for Float32
impl NormalizeCustom for Float32
fn normalize_custom(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NumericValue for Float32
impl NumericValue for Float32
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
Source§impl Serialize for Float32
impl Serialize for Float32
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl ValidateAuto for Float32
impl ValidateAuto for Float32
fn validate_self(&self, _ctx: &mut dyn VisitorContext)
Source§impl ValidateCustom for Float32
impl ValidateCustom for Float32
fn validate_custom(&self, _ctx: &mut dyn VisitorContext)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> CustomError for T
impl<T> CustomError for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> Normalize for Twhere
T: NormalizeAuto + NormalizeCustom,
Source§impl<T> NormalizeAndValidate for Twhere
T: Visitable,
impl<T> NormalizeAndValidate for Twhere
T: Visitable,
Source§fn normalize_and_validate(self) -> Result<Self, VisitorError>
fn normalize_and_validate(self) -> Result<Self, VisitorError>
Normalize and then validate this application-owned value. Read more