mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-04 06:39:07 +02:00
Replace DivRem trait with num-integer crate
This commit is contained in:
parent
1049aad03d
commit
96736bd7ed
4 changed files with 32 additions and 27 deletions
25
src/types.rs
25
src/types.rs
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
fmt::Debug,
|
||||
ops::{Div, Index, IndexMut, Rem},
|
||||
ops::{Index, IndexMut},
|
||||
};
|
||||
|
||||
use itertools::iproduct;
|
||||
|
@ -113,26 +113,3 @@ impl<T> IndexMut<ChunkCoords> for ChunkArray<T> {
|
|||
&mut self.0[index.z.0 as usize][index.x.0 as usize]
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate division and remainder at the same time
|
||||
pub trait DivRem<Rhs>
|
||||
where
|
||||
Self: Div<Rhs>,
|
||||
Self: Rem<Rhs>,
|
||||
{
|
||||
/// Returns the result of the division and remainder operations
|
||||
/// with the same inputs
|
||||
fn div_rem(self, rhs: Rhs) -> (<Self as Div<Rhs>>::Output, <Self as Rem<Rhs>>::Output);
|
||||
}
|
||||
|
||||
impl<Lhs, Rhs> DivRem<Rhs> for Lhs
|
||||
where
|
||||
Self: Div<Rhs>,
|
||||
Self: Rem<Rhs>,
|
||||
Self: Copy,
|
||||
Rhs: Copy,
|
||||
{
|
||||
fn div_rem(self, rhs: Rhs) -> (<Self as Div<Rhs>>::Output, <Self as Rem<Rhs>>::Output) {
|
||||
(self / rhs, self % rhs)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue