pub struct Float<'id> { /* private fields */ }Expand description
An Erlang float. Always IEEE 754 double precision (heap-allocated in the
BEAM even though the value is always f64).
Implementations§
Source§impl<'id> Float<'id>
impl<'id> Float<'id>
pub fn from_raw(raw_term: Term) -> Self
Available on crate feature
raw only.Sourcepub fn from_f64(env: impl Env<'id>, val: f64) -> Option<Self>
pub fn from_f64(env: impl Env<'id>, val: f64) -> Option<Self>
Construct a float term from an f64 (enif_make_double).
Returns None if val is not finite (NaN or infinity), which the BEAM
rejects with badarg. The check is done in Rust, so a rejected value
never calls into the BEAM and the env is never left with a pending
exception. A caller that wants a badarg can raise one from a CallEnv.
Trait Implementations§
impl<'id> Copy for Float<'id>
Source§impl<'id> Decoder<'id> for Float<'id>
Accepts a float term (enif_term_type == Float); WrongType
otherwise.
impl<'id> Decoder<'id> for Float<'id>
Accepts a float term (enif_term_type == Float); WrongType
otherwise.
Source§impl<'id> Encoder<'id> for Float<'id>
Encodes for free by rewrapping the term’s own machine word — an otter
term is already an Erlang term. Never fails.
impl<'id> Encoder<'id> for Float<'id>
Encodes for free by rewrapping the term’s own machine word — an otter term is already an Erlang term. Never fails.
impl Eq for Float<'_>
Source§impl Ord for Float<'_>
impl Ord for Float<'_>
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 Float<'_>
impl PartialOrd for Float<'_>
Source§impl<'id> Term<'id> for Float<'id>
impl<'id> Term<'id> for Float<'id>
Source§fn copy_to<'dst>(self, env: impl Env<'dst>) -> AnyTerm<'dst>where
Self: Sized,
fn copy_to<'dst>(self, env: impl Env<'dst>) -> AnyTerm<'dst>where
Self: Sized,
Copy this term into another environment (
enif_make_copy), producing a
term branded to the destination. The general cross-env copy — distinct
from same-brand Encoder (which wraps for free)
and from OwnedEnvArena copy_out (the arena exit).Auto Trait Implementations§
impl<'id> !Send for Float<'id>
impl<'id> !Sync for Float<'id>
impl<'id> Freeze for Float<'id>
impl<'id> RefUnwindSafe for Float<'id>
impl<'id> Unpin for Float<'id>
impl<'id> UnsafeUnpin for Float<'id>
impl<'id> UnwindSafe for Float<'id>
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