rs_internal_hasher 0.1.1

This package serves as an essential building block within the `rs_ssl` cryptographic library. It is focused on providing foundational functionality and infrastructure for various cryptographic operations within the larger project. While this package has been made publicly available to satisfy the dependency requirements of Rust's cargo system, its utility is predominantly realized in the context of the `rs_ssl` project. Unless you are developing or maintaining a component of the `rs_ssl` project, this package might offer limited direct utility. For access to a full suite of cryptographic functionalities, consider using the `rs_ssl` library bundle.
Documentation
use crate::BigEndianBytes;
use core::ops::{Add, AddAssign, BitAnd, Mul, Rem};

#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub struct U64Size(u64);

impl Add<usize> for U64Size {
    type Output = usize;

    fn add(self, rhs: usize) -> Self::Output {
        (self.0 + rhs as u64) as usize
    }
}

impl AddAssign<usize> for U64Size {
    fn add_assign(&mut self, rhs: usize) {
        self.0 += rhs as u64
    }
}

impl BitAnd for U64Size {
    type Output = usize;

    fn bitand(self, rhs: Self) -> Self::Output {
        (self.0 & rhs.0) as usize
    }
}

impl BitAnd<usize> for U64Size {
    type Output = usize;

    fn bitand(self, rhs: usize) -> Self::Output {
        (self.0 & rhs as u64) as usize
    }
}

impl BigEndianBytes for U64Size {
    type BigEndianBytesArray = [u8; 8];

    fn to_be_bytes(&self) -> Self::BigEndianBytesArray {
        (self.0 * 8).to_be_bytes()
    }
}

impl From<u64> for U64Size {
    fn from(value: u64) -> Self {
        Self(value)
    }
}

impl From<u128> for U64Size {
    fn from(value: u128) -> Self {
        Self(value as u64)
    }
}

impl From<usize> for U64Size {
    fn from(value: usize) -> Self {
        Self(value as u64)
    }
}

impl Mul<u32> for U64Size {
    type Output = Self;

    fn mul(self, rhs: u32) -> Self::Output {
        U64Size::from(self.0 * rhs as u64)
    }
}

impl Rem for U64Size {
    type Output = usize;

    fn rem(self, rhs: Self) -> Self::Output {
        (self.0 % rhs.0) as usize
    }
}

impl Rem<u8> for U64Size {
    type Output = usize;

    fn rem(self, rhs: u8) -> Self::Output {
        (self.0 % rhs as u64) as usize
    }
}