Struct az::Round

source · []
#[repr(transparent)]
pub struct Round<T>(pub T);
Expand description

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);

Tuple Fields

0: T

Trait Implementations

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

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

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

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Formats the value using the given formatter.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Casts the value.

OverflowingCasts the value.

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.