Skip to main content

DivCeil

Trait DivCeil 

Source
pub trait DivCeil: Sized {
    type Output;

    // Required method
    fn div_ceil(self, rhs: Self) -> Self::Output;
}
Expand description

Performs division, rounding the quotient towards positive infinity.

Required Associated Types§

Source

type Output

The quotient type (Self for the primitive impls).

Required Methods§

Source

fn div_ceil(self, rhs: Self) -> Self::Output

Calculates the quotient of self and rhs, rounding the result towards positive infinity.

§Panics

Panics if rhs is zero, or — with overflow checks enabled — on MIN / -1 for signed types.

use const_num_traits::DivCeil;

assert_eq!(DivCeil::div_ceil(7u8, 2), 4);
assert_eq!(DivCeil::div_ceil(7i8, -2), -3);
assert_eq!(DivCeil::div_ceil(-7i8, 2), -3);

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 DivCeil for i8

Source§

type Output = i8

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for i16

Source§

type Output = i16

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for i32

Source§

type Output = i32

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for i64

Source§

type Output = i64

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for i128

Source§

type Output = i128

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for isize

Source§

type Output = isize

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for u8

Source§

type Output = u8

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for u16

Source§

type Output = u16

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for u32

Source§

type Output = u32

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for u64

Source§

type Output = u64

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for u128

Source§

type Output = u128

Source§

fn div_ceil(self, rhs: Self) -> Self

Source§

impl DivCeil for usize

Source§

type Output = usize

Source§

fn div_ceil(self, rhs: Self) -> Self

Implementors§