Trait Xias

Source
pub trait Xias {
    // Provided methods
    fn homosign<T>(self) -> T
       where Self: Homosign<T> { ... }
    fn lossy_float<T>(self) -> T
       where Self: LossyFloat<T> { ... }
    fn small_int<T>(self) -> T
       where Self: SmallInt<T> { ... }
    fn small_float<T>(self) -> T
       where Self: SmallFloat<T> { ... }
    fn trunc_int<T>(self) -> T
       where Self: TruncInt<T> { ... }
}
Expand description

Blanket trait that imports all traits in this crate.

Improves syntax ergonomics by allowing the syntax foo.bar::<T>().

Provided Methods§

Source

fn homosign<T>(self) -> T
where Self: Homosign<T>,

Convert between signed and unsigned types of the same integer, assuming that the value is homogeneous over the conversion.

§Panics

Panics if the value is out of range after conversion.

Source

fn lossy_float<T>(self) -> T
where Self: LossyFloat<T>,

Downscale the precision of a floating point value.

§Panics

Panics if the value is infinite after conversion.

Source

fn small_int<T>(self) -> T
where Self: SmallInt<T>,

Reduce the size of an integer, assuming that the value is within the range of the new type.

§Panics

Panics if the value is out of range after conversion.

Source

fn small_float<T>(self) -> T
where Self: SmallFloat<T>,

Converts an integer to a floating point value, assuming that the value can be losslessly represented in the new type.

§Panics

Panics if the value is infinite after conversion.

Source

fn trunc_int<T>(self) -> T
where Self: TruncInt<T>,

Converts a floating point value to an integer by calling the f32::trunc/f64::trunc method.

§Panics

Panics if the truncated integer is not in the range of the output type.

Implementations on Foreign Types§

Source§

impl Xias for f32

Source§

impl Xias for f64

Source§

impl Xias for i8

Source§

impl Xias for i16

Source§

impl Xias for i32

Source§

impl Xias for i64

Source§

impl Xias for i128

Source§

impl Xias for isize

Source§

impl Xias for u8

Source§

impl Xias for u16

Source§

impl Xias for u32

Source§

impl Xias for u64

Source§

impl Xias for u128

Source§

impl Xias for usize

Implementors§