Struct az::Round[][src]

#[repr(transparent)]pub struct Round<T>(pub T);

Used to convert floating-point numbers to integers with rounding to the nearest, with ties rounded to even.

The underlying value can be retrieved through the .0 index.

Examples

use az::Round;
assert_eq!(az::cast::<_, i32>(Round(0.4)), 0);
assert_eq!(az::cast::<_, i32>(Round(0.6)), 1);
// ties rounded to even
assert_eq!(az::cast::<_, i32>(Round(-0.5)), 0);
assert_eq!(az::cast::<_, i32>(Round(-1.5)), -2);

Trait Implementations

impl Cast<Wrapping<i128>> for Round<f32>[src]

impl Cast<Wrapping<i128>> for Round<f64>[src]

impl Cast<Wrapping<i16>> for Round<f32>[src]

impl Cast<Wrapping<i16>> for Round<f64>[src]

impl Cast<Wrapping<i32>> for Round<f32>[src]

impl Cast<Wrapping<i32>> for Round<f64>[src]

impl Cast<Wrapping<i64>> for Round<f32>[src]

impl Cast<Wrapping<i64>> for Round<f64>[src]

impl Cast<Wrapping<i8>> for Round<f32>[src]

impl Cast<Wrapping<i8>> for Round<f64>[src]

impl Cast<Wrapping<isize>> for Round<f32>[src]

impl Cast<Wrapping<isize>> for Round<f64>[src]

impl Cast<Wrapping<u128>> for Round<f32>[src]

impl Cast<Wrapping<u128>> for Round<f64>[src]

impl Cast<Wrapping<u16>> for Round<f32>[src]

impl Cast<Wrapping<u16>> for Round<f64>[src]

impl Cast<Wrapping<u32>> for Round<f32>[src]

impl Cast<Wrapping<u32>> for Round<f64>[src]

impl Cast<Wrapping<u64>> for Round<f32>[src]

impl Cast<Wrapping<u64>> for Round<f64>[src]

impl Cast<Wrapping<u8>> for Round<f32>[src]

impl Cast<Wrapping<u8>> for Round<f64>[src]

impl Cast<Wrapping<usize>> for Round<f32>[src]

impl Cast<Wrapping<usize>> for Round<f64>[src]

impl Cast<i128> for Round<f32>[src]

impl Cast<i128> for Round<f64>[src]

impl Cast<i16> for Round<f32>[src]

impl Cast<i16> for Round<f64>[src]

impl Cast<i32> for Round<f32>[src]

impl Cast<i32> for Round<f64>[src]

impl Cast<i64> for Round<f32>[src]

impl Cast<i64> for Round<f64>[src]

impl Cast<i8> for Round<f32>[src]

impl Cast<i8> for Round<f64>[src]

impl Cast<isize> for Round<f32>[src]

impl Cast<isize> for Round<f64>[src]

impl Cast<u128> for Round<f32>[src]

impl Cast<u128> for Round<f64>[src]

impl Cast<u16> for Round<f32>[src]

impl Cast<u16> for Round<f64>[src]

impl Cast<u32> for Round<f32>[src]

impl Cast<u32> for Round<f64>[src]

impl Cast<u64> for Round<f32>[src]

impl Cast<u64> for Round<f64>[src]

impl Cast<u8> for Round<f32>[src]

impl Cast<u8> for Round<f64>[src]

impl Cast<usize> for Round<f32>[src]

impl Cast<usize> for Round<f64>[src]

impl CheckedCast<Wrapping<i128>> for Round<f32>[src]

impl CheckedCast<Wrapping<i128>> for Round<f64>[src]

impl CheckedCast<Wrapping<i16>> for Round<f32>[src]

impl CheckedCast<Wrapping<i16>> for Round<f64>[src]

impl CheckedCast<Wrapping<i32>> for Round<f32>[src]

impl CheckedCast<Wrapping<i32>> for Round<f64>[src]

impl CheckedCast<Wrapping<i64>> for Round<f32>[src]

impl CheckedCast<Wrapping<i64>> for Round<f64>[src]

impl CheckedCast<Wrapping<i8>> for Round<f32>[src]

impl CheckedCast<Wrapping<i8>> for Round<f64>[src]

impl CheckedCast<Wrapping<isize>> for Round<f32>[src]

impl CheckedCast<Wrapping<isize>> for Round<f64>[src]

impl CheckedCast<Wrapping<u128>> for Round<f32>[src]

impl CheckedCast<Wrapping<u128>> for Round<f64>[src]

impl CheckedCast<Wrapping<u16>> for Round<f32>[src]

impl CheckedCast<Wrapping<u16>> for Round<f64>[src]

impl CheckedCast<Wrapping<u32>> for Round<f32>[src]

impl CheckedCast<Wrapping<u32>> for Round<f64>[src]

impl CheckedCast<Wrapping<u64>> for Round<f32>[src]

impl CheckedCast<Wrapping<u64>> for Round<f64>[src]

impl CheckedCast<Wrapping<u8>> for Round<f32>[src]

impl CheckedCast<Wrapping<u8>> for Round<f64>[src]

impl CheckedCast<Wrapping<usize>> for Round<f32>[src]

impl CheckedCast<Wrapping<usize>> for Round<f64>[src]

impl CheckedCast<i128> for Round<f32>[src]

impl CheckedCast<i128> for Round<f64>[src]

impl CheckedCast<i16> for Round<f32>[src]

impl CheckedCast<i16> for Round<f64>[src]

impl CheckedCast<i32> for Round<f32>[src]

impl CheckedCast<i32> for Round<f64>[src]

impl CheckedCast<i64> for Round<f32>[src]

impl CheckedCast<i64> for Round<f64>[src]

impl CheckedCast<i8> for Round<f32>[src]

impl CheckedCast<i8> for Round<f64>[src]

impl CheckedCast<isize> for Round<f32>[src]

impl CheckedCast<isize> for Round<f64>[src]

impl CheckedCast<u128> for Round<f32>[src]

impl CheckedCast<u128> for Round<f64>[src]

impl CheckedCast<u16> for Round<f32>[src]

impl CheckedCast<u16> for Round<f64>[src]

impl CheckedCast<u32> for Round<f32>[src]

impl CheckedCast<u32> for Round<f64>[src]

impl CheckedCast<u64> for Round<f32>[src]

impl CheckedCast<u64> for Round<f64>[src]

impl CheckedCast<u8> for Round<f32>[src]

impl CheckedCast<u8> for Round<f64>[src]

impl CheckedCast<usize> for Round<f32>[src]

impl CheckedCast<usize> for Round<f64>[src]

impl<T: Clone> Clone for Round<T>[src]

impl<T: Copy> Copy for Round<T>[src]

impl<T: Debug> Debug for Round<T>[src]

impl<T: Default> Default for Round<T>[src]

impl<T: Display> Display for Round<T>[src]

impl<T: LowerExp> LowerExp for Round<T>[src]

impl OverflowingCast<i128> for Round<f32>[src]

impl OverflowingCast<i128> for Round<f64>[src]

impl OverflowingCast<i16> for Round<f32>[src]

impl OverflowingCast<i16> for Round<f64>[src]

impl OverflowingCast<i32> for Round<f32>[src]

impl OverflowingCast<i32> for Round<f64>[src]

impl OverflowingCast<i64> for Round<f32>[src]

impl OverflowingCast<i64> for Round<f64>[src]

impl OverflowingCast<i8> for Round<f32>[src]

impl OverflowingCast<i8> for Round<f64>[src]

impl OverflowingCast<isize> for Round<f32>[src]

impl OverflowingCast<isize> for Round<f64>[src]

impl OverflowingCast<u128> for Round<f32>[src]

impl OverflowingCast<u128> for Round<f64>[src]

impl OverflowingCast<u16> for Round<f32>[src]

impl OverflowingCast<u16> for Round<f64>[src]

impl OverflowingCast<u32> for Round<f32>[src]

impl OverflowingCast<u32> for Round<f64>[src]

impl OverflowingCast<u64> for Round<f32>[src]

impl OverflowingCast<u64> for Round<f64>[src]

impl OverflowingCast<u8> for Round<f32>[src]

impl OverflowingCast<u8> for Round<f64>[src]

impl OverflowingCast<usize> for Round<f32>[src]

impl OverflowingCast<usize> for Round<f64>[src]

impl<T: PartialEq> PartialEq<Round<T>> for Round<T>[src]

impl<T: PartialOrd> PartialOrd<Round<T>> for Round<T>[src]

impl SaturatingCast<i128> for Round<f32>[src]

impl SaturatingCast<i128> for Round<f64>[src]

impl SaturatingCast<i16> for Round<f32>[src]

impl SaturatingCast<i16> for Round<f64>[src]

impl SaturatingCast<i32> for Round<f32>[src]

impl SaturatingCast<i32> for Round<f64>[src]

impl SaturatingCast<i64> for Round<f32>[src]

impl SaturatingCast<i64> for Round<f64>[src]

impl SaturatingCast<i8> for Round<f32>[src]

impl SaturatingCast<i8> for Round<f64>[src]

impl SaturatingCast<isize> for Round<f32>[src]

impl SaturatingCast<isize> for Round<f64>[src]

impl SaturatingCast<u128> for Round<f32>[src]

impl SaturatingCast<u128> for Round<f64>[src]

impl SaturatingCast<u16> for Round<f32>[src]

impl SaturatingCast<u16> for Round<f64>[src]

impl SaturatingCast<u32> for Round<f32>[src]

impl SaturatingCast<u32> for Round<f64>[src]

impl SaturatingCast<u64> for Round<f32>[src]

impl SaturatingCast<u64> for Round<f64>[src]

impl SaturatingCast<u8> for Round<f32>[src]

impl SaturatingCast<u8> for Round<f64>[src]

impl SaturatingCast<usize> for Round<f32>[src]

impl SaturatingCast<usize> for Round<f64>[src]

impl<T> StructuralPartialEq for Round<T>[src]

impl UnwrappedCast<Wrapping<i128>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<i128>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<i16>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<i16>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<i32>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<i32>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<i64>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<i64>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<i8>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<i8>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<isize>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<isize>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<u128>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<u128>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<u16>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<u16>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<u32>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<u32>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<u64>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<u64>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<u8>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<u8>> for Round<f64>[src]

impl UnwrappedCast<Wrapping<usize>> for Round<f32>[src]

impl UnwrappedCast<Wrapping<usize>> for Round<f64>[src]

impl UnwrappedCast<i128> for Round<f32>[src]

impl UnwrappedCast<i128> for Round<f64>[src]

impl UnwrappedCast<i16> for Round<f32>[src]

impl UnwrappedCast<i16> for Round<f64>[src]

impl UnwrappedCast<i32> for Round<f32>[src]

impl UnwrappedCast<i32> for Round<f64>[src]

impl UnwrappedCast<i64> for Round<f32>[src]

impl UnwrappedCast<i64> for Round<f64>[src]

impl UnwrappedCast<i8> for Round<f32>[src]

impl UnwrappedCast<i8> for Round<f64>[src]

impl UnwrappedCast<isize> for Round<f32>[src]

impl UnwrappedCast<isize> for Round<f64>[src]

impl UnwrappedCast<u128> for Round<f32>[src]

impl UnwrappedCast<u128> for Round<f64>[src]

impl UnwrappedCast<u16> for Round<f32>[src]

impl UnwrappedCast<u16> for Round<f64>[src]

impl UnwrappedCast<u32> for Round<f32>[src]

impl UnwrappedCast<u32> for Round<f64>[src]

impl UnwrappedCast<u64> for Round<f32>[src]

impl UnwrappedCast<u64> for Round<f64>[src]

impl UnwrappedCast<u8> for Round<f32>[src]

impl UnwrappedCast<u8> for Round<f64>[src]

impl UnwrappedCast<usize> for Round<f32>[src]

impl UnwrappedCast<usize> for Round<f64>[src]

impl<T: UpperExp> UpperExp for Round<T>[src]

impl WrappingCast<i128> for Round<f32>[src]

impl WrappingCast<i128> for Round<f64>[src]

impl WrappingCast<i16> for Round<f32>[src]

impl WrappingCast<i16> for Round<f64>[src]

impl WrappingCast<i32> for Round<f32>[src]

impl WrappingCast<i32> for Round<f64>[src]

impl WrappingCast<i64> for Round<f32>[src]

impl WrappingCast<i64> for Round<f64>[src]

impl WrappingCast<i8> for Round<f32>[src]

impl WrappingCast<i8> for Round<f64>[src]

impl WrappingCast<isize> for Round<f32>[src]

impl WrappingCast<isize> for Round<f64>[src]

impl WrappingCast<u128> for Round<f32>[src]

impl WrappingCast<u128> for Round<f64>[src]

impl WrappingCast<u16> for Round<f32>[src]

impl WrappingCast<u16> for Round<f64>[src]

impl WrappingCast<u32> for Round<f32>[src]

impl WrappingCast<u32> for Round<f64>[src]

impl WrappingCast<u64> for Round<f32>[src]

impl WrappingCast<u64> for Round<f64>[src]

impl WrappingCast<u8> for Round<f32>[src]

impl WrappingCast<u8> for Round<f64>[src]

impl WrappingCast<usize> for Round<f32>[src]

impl WrappingCast<usize> for Round<f64>[src]

Auto Trait Implementations

impl<T> Send for Round<T> where
    T: Send

impl<T> Sync for Round<T> where
    T: Sync

impl<T> Unpin for Round<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Az for T[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedAs for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> OverflowingAs for T[src]

impl<T> SaturatingAs for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> UnwrappedAs for T[src]

impl<T> WrappingAs for T[src]