Skip to content

Commit 9c36e0c

Browse files
committed
Replace Integer with internal_type_traits::Integral
1 parent c323b7f commit 9c36e0c

File tree

2 files changed

+4
-41
lines changed

2 files changed

+4
-41
lines changed

src/internal_type_traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::{
1919
//
2020
// Maybe we should rename this to `PrimitiveInteger` or something, as it probably won't be used in the
2121
// same way as the original ACL.
22-
pub(crate) trait Integral:
22+
pub trait Integral:
2323
'static
2424
+ Send
2525
+ Sync

src/mincostflow.rs

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::internal_type_traits::Integral;
2+
13
pub struct MinCostFlowEdge<T> {
24
pub from: usize,
35
pub to: usize,
@@ -14,7 +16,7 @@ pub struct MinCostFlowGraph<T> {
1416

1517
impl<T> MinCostFlowGraph<T>
1618
where
17-
T: Integer + std::ops::Neg<Output = T>,
19+
T: Integral + std::ops::Neg<Output = T>,
1820
{
1921
pub fn new(n: usize) -> Self {
2022
Self {
@@ -180,49 +182,10 @@ struct _Edge<T> {
180182
cost: T,
181183
}
182184

183-
// TODO After we have Integer trait in [crate::internal_type_traits], remove this trait and use the new one
184-
pub trait Integer:
185-
Copy
186-
+ Ord
187-
+ std::ops::Not<Output = Self>
188-
+ std::ops::Add<Output = Self>
189-
+ std::ops::Sub<Output = Self>
190-
+ std::ops::Mul<Output = Self>
191-
+ std::ops::Div<Output = Self>
192-
+ std::ops::Rem<Output = Self>
193-
+ std::ops::AddAssign
194-
+ std::ops::SubAssign
195-
+ std::ops::MulAssign
196-
+ std::ops::DivAssign
197-
+ std::ops::RemAssign
198-
+ std::ops::BitOr<Output = Self>
199-
+ std::ops::BitAnd<Output = Self>
200-
+ std::ops::BitXor<Output = Self>
201-
+ std::ops::BitOrAssign
202-
+ std::ops::BitAndAssign
203-
+ std::ops::BitXorAssign
204-
+ std::ops::Shl<Output = Self>
205-
+ std::ops::Shr<Output = Self>
206-
+ std::ops::ShlAssign
207-
+ std::ops::ShrAssign
208-
+ std::fmt::Display
209-
+ std::fmt::Debug
210-
+ std::fmt::Binary
211-
+ std::fmt::Octal
212-
{
213-
fn zero() -> Self;
214-
}
215-
216185
#[cfg(test)]
217186
mod tests {
218187
use super::*;
219188

220-
impl Integer for i64 {
221-
fn zero() -> Self {
222-
0
223-
}
224-
}
225-
226189
#[test]
227190
fn test_min_cost_flow() {
228191
let mut graph = MinCostFlowGraph::new(4);

0 commit comments

Comments
 (0)