Crates.io | post-incr |
lib.rs | post-incr |
version | 0.1.0 |
source | src |
created_at | 2021-05-28 09:50:54.959492 |
updated_at | 2021-05-28 09:50:54.959492 |
description | Just add traits for post increment and decrement. |
homepage | |
repository | https://github.com/VillSnow/post-incr-rs/ |
max_upload_size | |
id | 403046 |
size | 15,581 |
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);