[]Trait game24::traits::Factorial

pub trait Factorial<Target = Self> {
    fn checked_factorial(&self) -> Option<Target>;

    fn factorial(&self) -> Target { ... }
}

Unary operator for computing the factorial of a number

Implements checked and unchecked versions of the formula

Required methods

fn checked_factorial(&self) -> Option<Target>

Returns self!, i.e. the factorial of self, if it doesn't overflow the type T.

Examples

use factorial::Factorial;
assert_eq!(10u32.checked_factorial(), Some(3628800));
Loading content...

Provided methods

fn factorial(&self) -> Target

Returns self!, i.e. the factorial of self.

Examples

use factorial::Factorial;
assert_eq!(10u32.factorial(), 3628800);
Loading content...

Implementors

impl Factorial<Maybe32> for Maybe32[src]

impl<T> Factorial<T> for T where
    T: PartialOrd<T> + CheckedMul + Unsigned

Loading content...