1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#![no_std]

use core::mem;

pub trait FlagExt {
    fn set(&mut self) -> bool;
    fn check(&mut self) -> bool;
}

impl FlagExt for bool {
    #[inline]
    fn set(&mut self) -> bool { mem::replace(self, true) }

    #[inline]
    fn check(&mut self) -> bool { mem::replace(self, false) }
}