Implement Idx for OwnerId.
This commit is contained in:
parent
024207ab43
commit
07f1948043
2 changed files with 15 additions and 1 deletions
|
@ -17,10 +17,12 @@ pub trait Idx: Copy + 'static + Eq + PartialEq + Debug + Hash {
|
|||
|
||||
fn index(self) -> usize;
|
||||
|
||||
#[inline]
|
||||
fn increment_by(&mut self, amount: usize) {
|
||||
*self = self.plus(amount);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn plus(self, amount: usize) -> Self {
|
||||
Self::new(self.index() + amount)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue