aboutsummaryrefslogtreecommitdiff
path: root/src/passwordmaker/base_conversion/division.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/passwordmaker/base_conversion/division.rs')
-rw-r--r--src/passwordmaker/base_conversion/division.rs32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/passwordmaker/base_conversion/division.rs b/src/passwordmaker/base_conversion/division.rs
deleted file mode 100644
index c6fc911..0000000
--- a/src/passwordmaker/base_conversion/division.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-/// A trait that combines std::ops::Div and std::ops::Rem, as those can often be computed together.
-pub(super) trait Division<D> where Self:Sized {
- /// does in-place arbitrary-length division. Returns remainder.
- fn divide(self, divisor : &D) -> DivisionResult<Self, D>;
- fn is_zero(&self) -> bool;
-}
-
-/// Or mark your type as `UseGenericDivision` to just use `/` and `%` operators for types. Makes only sense for integers.
-pub(super) trait UseGenericDivision : Clone
- + for <'a> std::ops::Div<&'a Self, Output = Self>
- + for <'a> std::ops::Rem<&'a Self, Output = Self>
- + Default
- + Eq {}
-
- impl<U> Division<U> for U
- where U: UseGenericDivision
-{
- fn divide(self, divisor : &Self) -> DivisionResult<Self, Self> {
- DivisionResult {
- result: self.clone().div(divisor),
- remainder: self.rem(divisor)
- }
- }
- fn is_zero(&self) -> bool {
- *self == Self::default()
- }
-}
-
-pub(super) struct DivisionResult<T, U> {
- pub result : T,
- pub remainder : U,
-} \ No newline at end of file