1+ use crate :: internal_type_traits:: Integral ;
2+
13pub struct MinCostFlowEdge < T > {
24 pub from : usize ,
35 pub to : usize ,
@@ -14,7 +16,7 @@ pub struct MinCostFlowGraph<T> {
1416
1517impl < T > MinCostFlowGraph < T >
1618where
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) ]
217186mod 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