@@ -100,84 +100,3 @@ macro_rules! impl_floats {
100100impl_floats ! ( f16) ;
101101impl_floats ! ( f32 ) ;
102102impl_floats ! ( f64 ) ;
103-
104- /// Performs addition that returns None instead of wrapping around on overflow.
105- pub trait CheckedAdd < Rhs = Self > {
106- /// The result type after performing the operation.
107- type Output ;
108-
109- /// Perform the operation.
110- fn checked_add ( self , other : Rhs ) -> Option < Self :: Output > ;
111- }
112-
113- impl < A , Rhs , Output > CheckedAdd < Rhs > for A
114- where
115- A : Checked < Add , Rhs , Output = Output > ,
116- {
117- type Output = Output ;
118-
119- fn checked_add ( self , other : Rhs ) -> Option < Self :: Output > {
120- self . checked_op ( other)
121- }
122- }
123-
124- /// Performs subtraction that returns None instead of wrapping around on underflow.
125- pub trait CheckedSub < Rhs = Self > {
126- /// The result type after performing the operation.
127- type Output ;
128-
129- /// Perform the operation.
130- fn checked_sub ( self , other : Rhs ) -> Option < Self :: Output > ;
131- }
132-
133- impl < A , Rhs , Output > CheckedSub < Rhs > for A
134- where
135- A : Checked < Sub , Rhs , Output = Output > ,
136- {
137- type Output = Output ;
138-
139- fn checked_sub ( self , other : Rhs ) -> Option < Self :: Output > {
140- self . checked_op ( other)
141- }
142- }
143-
144- /// Performs multiplication that returns None instead of wrapping around on underflow or overflow.
145- pub trait CheckedMul < Rhs = Self > {
146- /// The result type after performing the operation.
147- type Output ;
148-
149- /// Perform the operation.
150- fn checked_mul ( self , other : Rhs ) -> Option < Self :: Output > ;
151- }
152-
153- impl < A , Rhs , Output > CheckedMul < Rhs > for A
154- where
155- A : Checked < Mul , Rhs , Output = Output > ,
156- {
157- type Output = Output ;
158-
159- fn checked_mul ( self , other : Rhs ) -> Option < Self :: Output > {
160- self . checked_op ( other)
161- }
162- }
163-
164- /// Performs division that returns None instead of panicking on division by zero and instead of
165- /// wrapping around on underflow and overflow.
166- pub trait CheckedDiv < Rhs = Self > {
167- /// The result type after performing the operation.
168- type Output ;
169-
170- /// Perform the operation.
171- fn checked_div ( self , other : Rhs ) -> Option < Self :: Output > ;
172- }
173-
174- impl < A , Rhs , Output > CheckedDiv < Rhs > for A
175- where
176- A : Checked < Div , Rhs , Output = Output > ,
177- {
178- type Output = Output ;
179-
180- fn checked_div ( self , other : Rhs ) -> Option < Self :: Output > {
181- self . checked_op ( other)
182- }
183- }
0 commit comments