There are a few places where I've seen, or they could benefit from a, checked_add and checked_sub implementations throughout the library, such as on VirtAddr, PhysFrame, PhysAddr... etc. I would like to define a CheckedAdd and CheckedSub trait similar to the std::ops::Add trait that defines a checked_* method.
pub trait CheckedAdd<Rhs = Self> {
type Output;
fn checked_add(self, rhs: Rhs) -> Option<Self::Output>;
}
pub trait CheckedSub<Rhs = Self> {
type Output;
fn checked_sub(self, rhs: Rhs) -> Option<Self::Output>;
}
I would like to add this specifically to provide for checked_operations across multiple Rhs types. An example being a CheckedAdd<Rhs=PhysFrame> for PhysFrame and CheckedAdd<Rhs=PhysAddr> for PhysFrame.
There are a few places where I've seen, or they could benefit from a,
checked_addandchecked_subimplementations throughout the library, such as onVirtAddr,PhysFrame,PhysAddr... etc. I would like to define aCheckedAddandCheckedSubtrait similar to thestd::ops::Addtrait that defines a checked_* method.I would like to add this specifically to provide for checked_operations across multiple
Rhstypes. An example being aCheckedAdd<Rhs=PhysFrame> for PhysFrameandCheckedAdd<Rhs=PhysAddr> for PhysFrame.