flagset
flagset copied to clipboard
fix: use absolute path references to `rust-core` in flags macro
The following code is ideal but can not be compiled.
use flagset::{FlagSet, flags};
mod core {}
flags! {
enum Flags: u8 {
Foo,
Bar,
Baz,
}
}
struct Container(FlagSet<Flags>);
impl Container {
fn new(flags: impl Into<FlagSet<Flags>>) -> Container {
Container(flags.into())
}
}
assert_eq!(Container::new(Flags::Foo | Flags::Bar).0.bits(), 0b011);
assert_eq!(Container::new(Flags::Foo).0.bits(), 0b001);
assert_eq!(Container::new(None).0.bits(), 0b000);
Absolute path references to rust-core
can avoid to use user defined or imported module.