File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,40 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
335
335
{
336
336
self . clone ( ) - self . mod_floor ( other)
337
337
}
338
+
339
+ /// Decrements self by one.
340
+ ///
341
+ /// # Examples
342
+ ///
343
+ /// ~~~
344
+ /// # use num_integer::Integer;
345
+ /// let mut x: i32 = 43;
346
+ /// x.dec();
347
+ /// assert_eq!(x, 42);
348
+ /// ~~~
349
+ fn dec ( & mut self )
350
+ where
351
+ Self : Clone ,
352
+ {
353
+ * self = self . clone ( ) - Self :: one ( )
354
+ }
355
+
356
+ /// Increments self by one.
357
+ ///
358
+ /// # Examples
359
+ ///
360
+ /// ~~~
361
+ /// # use num_integer::Integer;
362
+ /// let mut x: i32 = 41;
363
+ /// x.inc();
364
+ /// assert_eq!(x, 42);
365
+ /// ~~~
366
+ fn inc ( & mut self )
367
+ where
368
+ Self : Clone ,
369
+ {
370
+ * self = self . clone ( ) + Self :: one ( )
371
+ }
338
372
}
339
373
340
374
/// Greatest common divisor and Bézout coefficients
You can’t perform that action at this time.
0 commit comments