flag/
lib.rs

1#![no_std]
2
3use core::mem;
4
5pub trait FlagExt {
6    fn set(&mut self) -> bool;
7    fn check(&mut self) -> bool;
8}
9
10impl FlagExt for bool {
11    #[inline]
12    fn set(&mut self) -> bool { mem::replace(self, true) }
13
14    #[inline]
15    fn check(&mut self) -> bool { mem::replace(self, false) }
16}