Skip to main content

Exact

Struct Exact 

Source
pub struct Exact;
Expand description

Exact conversion only

Successful conversions using this “rounding” mode must preserve the value exactly.

Example: 2.0_f32 may convert to 2_i32. 2.1_f32 is not convertible to i32.

Another example: u128::MAX (which is larger than f32::MAX) may not be converted to f32 with Exact rounding (with other modes it may round to f32::INFINITY).

Trait Implementations§

Source§

impl Clone for Exact

Source§

fn clone(&self) -> Exact

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S, T: ConvExact<S>> ConvTo<S, Exact> for T

Source§

type Error = <T as ConvExact<S>>::Error

Conversion error type Read more
Source§

fn try_conv_to(_: Exact, s: S) -> Result<Self, Self::Error>

Try converting from S to Self, rounding according to mode
Source§

fn conv_to(_: Exact, s: S) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

impl ConvTo<f64, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn try_conv_to(_: Exact, x: f64) -> Result<f32, Self::Error>

Try converting from S to Self, rounding according to mode
Source§

fn conv_to(_: Exact, x: f64) -> f32

Convert from S to Self, rounding according to mode Read more
Source§

impl ConvTo<i32, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: i32) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: i32) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<i64, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: i64) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: i64) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<i64, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: i64) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: i64) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<i128, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: i128) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: i128) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<i128, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: i128) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: i128) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<isize, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: isize) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: isize) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<isize, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: isize) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: isize) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<u32, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: u32) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: u32) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<u64, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: u64) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: u64) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<u64, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: u64) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: u64) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<u128, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: u128) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: u128) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<u128, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: u128) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: u128) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<usize, Exact> for f32

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: usize) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: usize) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl ConvTo<usize, Exact> for f64

Source§

type Error = Error

Conversion error type Read more
Source§

fn conv_to(_: Exact, x: usize) -> Self

Convert from S to Self, rounding according to mode Read more
Source§

fn try_conv_to(_: Exact, x: usize) -> Result<Self, Error>

Try converting from S to Self, rounding according to mode
Source§

impl Copy for Exact

Source§

impl Debug for Exact

Source§

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

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

impl Default for Exact

Source§

fn default() -> Exact

Returns the “default value” for a type. Read more
Source§

impl Rounding for Exact

Source§

type MaximumError = Error

Maximum error type

Auto Trait Implementations§

§

impl Freeze for Exact

§

impl RefUnwindSafe for Exact

§

impl Send for Exact

§

impl Sync for Exact

§

impl Unpin for Exact

§

impl UnsafeUnpin for Exact

§

impl UnwindSafe for Exact

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<S, T> Cast<T> for S
where T: Conv<S>,

Source§

type Error = <T as Conv<S>>::Error

Conversion error type Read more
Source§

fn cast(self) -> T

Cast from Self to T Read more
Source§

fn try_cast(self) -> Result<T, <S as Cast<T>>::Error>

Try converting from Self to T
Source§

impl<S, T> CastApprox<T> for S
where T: ConvApprox<S>,

Source§

type Error = <T as ConvApprox<S>>::Error

Conversion error type Read more
Source§

fn try_cast_approx(self) -> Result<T, <S as CastApprox<T>>::Error>

Try approximate conversion from Self to T
Source§

fn cast_approx(self) -> T

Cast approximately from Self to T Read more
Source§

impl<R, S, T> CastTo<T, R> for S
where R: Rounding, T: ConvTo<S, R>,

Source§

type Error = <T as ConvTo<S, R>>::Error

Conversion error type Read more
Source§

fn try_cast_to(self, mode: R) -> Result<T, <S as CastTo<T, R>>::Error>

Try converting from Self to T, rounding according to mode
Source§

fn cast_to(self, mode: R) -> T

Convert from Self to T, rounding according to mode Read more
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.