#post #increment #traits #incr #decrement #post-decr

post-incr

Just add traits for post increment and decrement

1 unstable release

0.1.0 May 28, 2021

#10 in #increment

MIT/Apache

6KB

post-incr-rs

Just add traits for post increment and decrement.

use post_incr::PostIncr as _;
use post_incr::PostDecr as _;

let mut x: i32 = 0;
assert_eq!(x.post_incr(), 0);
assert_eq!(x.post_incr(), 1);
assert_eq!(x.post_incr(), 2);

assert_eq!(x.post_decr(), 3);
assert_eq!(x.post_decr(), 2);
assert_eq!(x.post_decr(), 1);

lib.rs:

Just add traits for post increment and decrement.

use post_incr::PostIncr as _;
use post_incr::PostDecr as _;

let mut x: i32 = 0;
assert_eq!(x.post_incr(), 0);
assert_eq!(x.post_incr(), 1);
assert_eq!(x.post_incr(), 2);

assert_eq!(x.post_decr(), 3);
assert_eq!(x.post_decr(), 2);
assert_eq!(x.post_decr(), 1);

Dependencies

~150KB