Open
Description
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
.
Metadata
Metadata
Assignees
Labels
No labels