Registry / utility / bitflags

bitflags

JSON →
library2.13.0rscratesunverified

A macro to generate structures which behave like bitflags.

# Cargo.toml [dependencies] bitflags = "2.13.0"
INSTALL
IMPORT
SIG · BITFLAGS
B
bitflags
utilityrustv2.13.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bitflags
use bitflags::bitflags;

Defines a bitflags struct with three flags and demonstrates bitwise OR.

use bitflags::bitflags; bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct MyFlags: u32 { const FLAG_A = 0b00000001; const FLAG_B = 0b00000010; const FLAG_C = 0b00000100; } } fn main() { let flags = MyFlags::FLAG_A | MyFlags::FLAG_C; println!("{:?}", flags); }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
2.13.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Meta
1
Amazon
1
Resources
bitflags — cargo add bitflags · libregistry