Struct rhai::FloatWrapper

source ·
pub struct FloatWrapper<F>(/* private fields */);
Expand description

(internals) A type that wraps a floating-point number and implements Hash. Exported under the internals feature only.

Not available under no_float.

Implementations§

source§

impl<F: Float> FloatWrapper<F>

source

pub const MAX_NATURAL_FLOAT_FOR_DISPLAY: f32 = 9.99999982E+12f32

Maximum floating-point number for natural display before switching to scientific notation.

source

pub const MIN_NATURAL_FLOAT_FOR_DISPLAY: f32 = 9.99999982E-14f32

Minimum floating-point number for natural display before switching to scientific notation.

source

pub const fn new(value: F) -> Self

Create a new FloatWrapper.

Trait Implementations§

source§

impl<F: Float> AsMut<F> for FloatWrapper<F>

source§

fn as_mut(&mut self) -> &mut F

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<F: Float> AsRef<F> for FloatWrapper<F>

source§

fn as_ref(&self) -> &F

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<F: Clone> Clone for FloatWrapper<F>

source§

fn clone(&self) -> FloatWrapper<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Float + Debug> Debug for FloatWrapper<F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: Float> Deref for FloatWrapper<F>

§

type Target = F

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<F: Float> DerefMut for FloatWrapper<F>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<F: Float + Display + LowerExp + From<f32>> Display for FloatWrapper<F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: Float> From<F> for FloatWrapper<F>

source§

fn from(value: F) -> Self

Converts to this type from the input type.
source§

impl From<FloatWrapper<f64>> for Dynamic

source§

fn from(value: FloatWrapper<FLOAT>) -> Self

Converts to this type from the input type.
source§

impl<F: Float + FromStr> FromStr for FloatWrapper<F>

§

type Err = <F as FromStr>::Err

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for FloatWrapper<FLOAT>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<F: PartialEq> PartialEq for FloatWrapper<F>

source§

fn eq(&self, other: &FloatWrapper<F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F: PartialOrd> PartialOrd for FloatWrapper<F>

source§

fn partial_cmp(&self, other: &FloatWrapper<F>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<F: Copy> Copy for FloatWrapper<F>

source§

impl<F: Eq> Eq for FloatWrapper<F>

source§

impl<F> StructuralPartialEq for FloatWrapper<F>

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for FloatWrapper<F>
where F: RefUnwindSafe,

§

impl<F> Send for FloatWrapper<F>
where F: Send,

§

impl<F> Sync for FloatWrapper<F>
where F: Sync,

§

impl<F> Unpin for FloatWrapper<F>
where F: Unpin,

§

impl<F> UnwindSafe for FloatWrapper<F>
where F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Variant for T
where T: Any + Clone + SendSync,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert this Variant trait object to &dyn Any.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert this Variant trait object to &mut dyn Any.
source§

fn as_boxed_any(self: Box<T>) -> Box<dyn Any>

Convert this Variant trait object to Box<dyn Any>.
source§

fn type_name(&self) -> &'static str

Get the name of this type.
source§

fn clone_object(&self) -> Box<dyn Variant>

Clone this Variant trait object.