1
+ use crate :: internal_type_traits:: Integral ;
2
+
1
3
pub struct MinCostFlowEdge < T > {
2
4
pub from : usize ,
3
5
pub to : usize ,
@@ -14,7 +16,7 @@ pub struct MinCostFlowGraph<T> {
14
16
15
17
impl < T > MinCostFlowGraph < T >
16
18
where
17
- T : Integer + std:: ops:: Neg < Output = T > ,
19
+ T : Integral + std:: ops:: Neg < Output = T > ,
18
20
{
19
21
pub fn new ( n : usize ) -> Self {
20
22
Self {
@@ -180,49 +182,10 @@ struct _Edge<T> {
180
182
cost : T ,
181
183
}
182
184
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
-
216
185
#[ cfg( test) ]
217
186
mod tests {
218
187
use super :: * ;
219
188
220
- impl Integer for i64 {
221
- fn zero ( ) -> Self {
222
- 0
223
- }
224
- }
225
-
226
189
#[ test]
227
190
fn test_min_cost_flow ( ) {
228
191
let mut graph = MinCostFlowGraph :: new ( 4 ) ;
0 commit comments