Skip to main content

ConvTo

Trait ConvTo 

Source
pub trait ConvTo<S, R: Rounding>: Sized {
    type Error: Into<R::MaximumError> + Error;

    // Required method
    fn try_conv_to(mode: R, s: S) -> Result<Self, Self::Error>;

    // Provided method
    fn conv_to(mode: R, s: S) -> Self { ... }
}
Expand description

Generic “from” conversion trait with specified rounding mode

This trait supports From- and TryFrom-like conversions, but with a specified rounding mode:

  • Conversions may be fallible, like TryFrom.
  • Conversions may be lossy, according to the Rounding mode used.
  • Conversions must be value-preserving, like From. For example, -1_i8 and -1_i32 are conceptually the same value while 255_u8 is conceptually a different value.

The Rounding mode must be specified:

assert_eq!(i32::conv_to(Nearest, 7.6f32), 8);
assert_eq!(f32::conv_to(Exact, 20), 20.0);

Usage with Exact and Approx is equivalent to usage of Conv and ConvApprox respectively.

The sister-trait CastTo supports “into” style usage.

§Implementing conversions

Implement conversions which cannot lose precision using ConvExact and other conversions using this trait. Separate implementations may be provided for each Rounding mode.

§Example

use easy_cast::{Approx, ConvTo, Error, Exact, RangeError};

struct MyFloat { /* details */ }

impl ConvTo<MyFloat, Exact> for i32 {
    type Error = Error;

    fn try_conv_to(_: Exact, f: MyFloat) -> Result<Self, Self::Error> {
        if f.is_in_range_of::<i32>() {
            if f.is_integral() {
                Ok(todo!())
            } else {
                Err(Error::Inexact)
            }
        } else {
            Err(Error::Range)
        }
    }

    // optionally also impl fn conv
}

impl ConvTo<MyFloat, Approx> for i32 {
    type Error = RangeError;

    fn try_conv_to(_: Approx, f: MyFloat) -> Result<Self, Self::Error> {
        if f.is_in_range_of::<i32>() {
            Ok(todo!())
        } else {
            Err(RangeError)
        }
    }

    // optionally also impl fn conv
}

// optionally also implement ConvTo for other rounding modes

Required Associated Types§

Source

type Error: Into<R::MaximumError> + Error

Conversion error type

This should be one of Infallible, RangeError or Error.

Required Methods§

Source

fn try_conv_to(mode: R, s: S) -> Result<Self, Self::Error>

Try converting from S to Self, rounding according to mode

Provided Methods§

Source

fn conv_to(mode: R, s: S) -> Self

Convert from S to Self, rounding according to mode

Use this method only when success is expected. On error, this method may panic or may exhibit § Fallback behaviour.

§Implementing

Implementing this method directly (with fallback behaviour) is optional. In debug builds, this method must panic on error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ConvTo<f32, Approx> for i8

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for i16

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for i32

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for i64

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for i128

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for isize

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for u8

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for u16

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for u32

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for u64

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for u128

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Approx> for usize

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f32) -> Self

Source§

impl ConvTo<f32, Ceil> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Ceil> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Floor> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Nearest> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f32, Trunc> for i8

Source§

impl ConvTo<f32, Trunc> for i16

Source§

impl ConvTo<f32, Trunc> for i32

Source§

impl ConvTo<f32, Trunc> for i64

Source§

impl ConvTo<f32, Trunc> for i128

Source§

impl ConvTo<f32, Trunc> for isize

Source§

impl ConvTo<f32, Trunc> for u8

Source§

impl ConvTo<f32, Trunc> for u16

Source§

impl ConvTo<f32, Trunc> for u32

Source§

impl ConvTo<f32, Trunc> for u64

Source§

impl ConvTo<f32, Trunc> for u128

Source§

impl ConvTo<f32, Trunc> for usize

Source§

impl ConvTo<f64, Approx> for f32

Source§

impl ConvTo<f64, Approx> for i8

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for i16

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for i32

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for i64

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for i128

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for isize

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for u8

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for u16

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for u32

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for u64

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for u128

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Approx> for usize

Source§

type Error = RangeError

Source§

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

Source§

fn conv_to(_: Approx, x: f64) -> Self

Source§

impl ConvTo<f64, Ceil> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Ceil> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Exact> for f32

Source§

impl ConvTo<f64, Floor> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Floor> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for i8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for i16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for i32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for i64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for i128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for isize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for u8

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for u16

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for u32

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for u64

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for u128

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Nearest> for usize

Available on crate features libm or std only.
Source§

impl ConvTo<f64, Trunc> for i8

Source§

impl ConvTo<f64, Trunc> for i16

Source§

impl ConvTo<f64, Trunc> for i32

Source§

impl ConvTo<f64, Trunc> for i64

Source§

impl ConvTo<f64, Trunc> for i128

Source§

impl ConvTo<f64, Trunc> for isize

Source§

impl ConvTo<f64, Trunc> for u8

Source§

impl ConvTo<f64, Trunc> for u16

Source§

impl ConvTo<f64, Trunc> for u32

Source§

impl ConvTo<f64, Trunc> for u64

Source§

impl ConvTo<f64, Trunc> for u128

Source§

impl ConvTo<f64, Trunc> for usize

Source§

impl ConvTo<i32, Approx> for f32

Source§

impl ConvTo<i32, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<i32, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<i64, Approx> for f32

Source§

impl ConvTo<i64, Approx> for f64

Source§

impl ConvTo<i64, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<i64, Exact> for f64

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<i64, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<i64, Nearest> for f64

Available on crate features libm or std only.
Source§

impl ConvTo<i128, Approx> for f32

Source§

impl ConvTo<i128, Approx> for f64

Source§

impl ConvTo<i128, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<i128, Exact> for f64

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<i128, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<i128, Nearest> for f64

Available on crate features libm or std only.
Source§

impl ConvTo<isize, Approx> for f32

Source§

impl ConvTo<isize, Approx> for f64

Source§

impl ConvTo<isize, Exact> for f32

Source§

impl ConvTo<isize, Exact> for f64

Source§

impl ConvTo<isize, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<isize, Nearest> for f64

Available on crate features libm or std only.
Source§

impl ConvTo<u32, Approx> for f32

Source§

impl ConvTo<u32, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<u32, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<u64, Approx> for f32

Source§

impl ConvTo<u64, Approx> for f64

Source§

impl ConvTo<u64, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<u64, Exact> for f64

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<u64, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<u64, Nearest> for f64

Available on crate features libm or std only.
Source§

impl ConvTo<u128, Approx> for f32

Source§

impl ConvTo<u128, Approx> for f64

Source§

impl ConvTo<u128, Exact> for f32

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<u128, Exact> for f64

Source§

type Error = Error

Source§

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

Source§

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

Source§

impl ConvTo<u128, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<u128, Nearest> for f64

Available on crate features libm or std only.
Source§

impl ConvTo<usize, Approx> for f32

Source§

impl ConvTo<usize, Approx> for f64

Source§

impl ConvTo<usize, Exact> for f32

Source§

impl ConvTo<usize, Exact> for f64

Source§

impl ConvTo<usize, Nearest> for f32

Available on crate features libm or std only.
Source§

impl ConvTo<usize, Nearest> for f64

Available on crate features libm or std only.
Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<Range<F>, R> for Range<T>

Source§

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

Source§

fn try_conv_to(mode: R, n: Range<F>) -> Result<Range<T>, Self::Error>

Source§

fn conv_to(mode: R, n: Range<F>) -> Range<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<Range<F>, R> for Range<T>

Source§

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

Source§

fn try_conv_to(mode: R, n: Range<F>) -> Result<Range<T>, Self::Error>

Source§

fn conv_to(mode: R, n: Range<F>) -> Range<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<RangeFrom<F>, R> for RangeFrom<T>

Source§

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

Source§

fn try_conv_to(mode: R, n: RangeFrom<F>) -> Result<RangeFrom<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeFrom<F>) -> RangeFrom<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<RangeFrom<F>, R> for RangeFrom<T>

Source§

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

Source§

fn try_conv_to(mode: R, n: RangeFrom<F>) -> Result<RangeFrom<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeFrom<F>) -> RangeFrom<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<RangeTo<F>, R> for RangeTo<T>

Source§

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

Source§

fn try_conv_to(mode: R, n: RangeTo<F>) -> Result<RangeTo<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeTo<F>) -> RangeTo<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<RangeToInclusive<F>, R> for RangeToInclusive<T>

Source§

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

Source§

fn try_conv_to( mode: R, n: RangeToInclusive<F>, ) -> Result<RangeToInclusive<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeToInclusive<F>) -> RangeToInclusive<T>

Source§

impl<R: Rounding, F, T: ConvTo<F, R>> ConvTo<RangeToInclusive<F>, R> for RangeToInclusive<T>

Source§

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

Source§

fn try_conv_to( mode: R, n: RangeToInclusive<F>, ) -> Result<RangeToInclusive<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeToInclusive<F>) -> RangeToInclusive<T>

Source§

impl<R: Rounding, F: Clone, T: ConvTo<F, R>> ConvTo<RangeInclusive<F>, R> for RangeInclusive<T>

Source§

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

Source§

fn try_conv_to( mode: R, n: RangeInclusive<F>, ) -> Result<RangeInclusive<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeInclusive<F>) -> RangeInclusive<T>

Source§

impl<R: Rounding, F: Clone, T: ConvTo<F, R>> ConvTo<RangeInclusive<F>, R> for RangeInclusive<T>

Source§

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

Source§

fn try_conv_to( mode: R, n: RangeInclusive<F>, ) -> Result<RangeInclusive<T>, Self::Error>

Source§

fn conv_to(mode: R, n: RangeInclusive<F>) -> RangeInclusive<T>

Source§

impl<R: Rounding, S0, S1, S2, S3, S4, S5, T0, T1, T2, T3, T4, T5> ConvTo<(S0, S1, S2, S3, S4, S5), R> for (T0, T1, T2, T3, T4, T5)
where T0: ConvTo<S0, R>, T1: ConvTo<S1, R>, T2: ConvTo<S2, R>, T3: ConvTo<S3, R>, T4: ConvTo<S4, R>, T5: ConvTo<S5, R>,

Source§

impl<R: Rounding, S0, S1, S2, S3, S4, T0: ConvTo<S0, R>, T1: ConvTo<S1, R>, T2: ConvTo<S2, R>, T3: ConvTo<S3, R>, T4: ConvTo<S4, R>> ConvTo<(S0, S1, S2, S3, S4), R> for (T0, T1, T2, T3, T4)

Source§

type Error = <R as Rounding>::MaximumError

Source§

fn try_conv_to(mode: R, ss: (S0, S1, S2, S3, S4)) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: (S0, S1, S2, S3, S4)) -> Self

Source§

impl<R: Rounding, S0, S1, S2, S3, T0: ConvTo<S0, R>, T1: ConvTo<S1, R>, T2: ConvTo<S2, R>, T3: ConvTo<S3, R>> ConvTo<(S0, S1, S2, S3), R> for (T0, T1, T2, T3)

Source§

type Error = <R as Rounding>::MaximumError

Source§

fn try_conv_to(mode: R, ss: (S0, S1, S2, S3)) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: (S0, S1, S2, S3)) -> Self

Source§

impl<R: Rounding, S0, S1, S2, T0: ConvTo<S0, R>, T1: ConvTo<S1, R>, T2: ConvTo<S2, R>> ConvTo<(S0, S1, S2), R> for (T0, T1, T2)

Source§

type Error = <R as Rounding>::MaximumError

Source§

fn try_conv_to(mode: R, ss: (S0, S1, S2)) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: (S0, S1, S2)) -> Self

Source§

impl<R: Rounding, S0, S1, T0: ConvTo<S0, R>, T1: ConvTo<S1, R>> ConvTo<(S0, S1), R> for (T0, T1)

Source§

type Error = <R as Rounding>::MaximumError

Source§

fn try_conv_to(mode: R, ss: (S0, S1)) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: (S0, S1)) -> Self

Source§

impl<R: Rounding, S0, T0: ConvTo<S0, R>> ConvTo<(S0,), R> for (T0,)

Source§

type Error = <T0 as ConvTo<S0, R>>::Error

Source§

fn try_conv_to(mode: R, ss: (S0,)) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: (S0,)) -> Self

Source§

impl<R: Rounding, S, T: ConvTo<S, R> + Copy + Default, const N: usize> ConvTo<[S; N], R> for [T; N]

Source§

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

Source§

fn try_conv_to(mode: R, ss: [S; N]) -> Result<Self, Self::Error>

Source§

fn conv_to(mode: R, ss: [S; N]) -> Self

Source§

impl<R: Rounding> ConvTo<(), R> for ()

Source§

type Error = Infallible

Source§

fn try_conv_to(_: R, _: ()) -> Result<Self, Self::Error>

Source§

fn conv_to(_: R, _: ()) -> Self

Implementors§

Source§

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

Source§

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

Source§

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

Available on crate features libm or std only.
Source§

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

Source§

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

Source§

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

Source§

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

Available on crate features libm or std only.
Source§

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

Source§

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

Available on crate features libm or std only.
Source§

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

Source§

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

Available on crate features libm or std only.
Source§

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