rutil 0.2.0

A library containing utilities for creating programs in rust.
Documentation
/// Euclid operations.
pub trait EuclidOps {
    /// Calculates Euclidean division, the matching method for `rem_euclid`.
    fn div_euclid(self, rhs: Self) -> Self;

    /// Calculates the least nonnegative remainder of `self (mod rhs)`.
    fn rem_euclid(self, rhs: Self) -> Self;
}

/// Implements [`EuclidOps`].
macro_rules! impl_euclid {
    ($($t:ty),*) => {
        $(impl EuclidOps for $t {
            #[inline] fn div_euclid(self, rhs: Self) -> Self { self.div_euclid(rhs) }
            #[inline] fn rem_euclid(self, rhs: Self) -> Self { self.rem_euclid(rhs) }
        })*
    };
}

impl_euclid!(u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize, f32, f64);