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

post-incr

仅添加后增量减量特性

1 个不稳定版本

0.1.0 2021年5月28日

#10#increment

MIT/Apache

6KB

post-incr-rs

仅添加后增量减量特性。

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:

仅添加后增量减量特性。

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);

依赖项

~150KB