If crate user want to set up arbitrary value like old fashion C code, they can do vec![LinkFlag::Other(65)] which is equal to vec![LinkFlag::Running, LinkFlag::Up]. I don't know what this const _ could do. When using bitflags, you are forcing me and crate user to learn new ...
usebitflags::bitflags;// The `bitflags!` macro generates `struct`s that manage a set of flags.bitflags!{/// Represents a set of flags.#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)]structFlags:u32{/// The value `A`, at bit position `0`.constA=0b00000001;/// The val...
Rust中的enum不打算用作位标志。PublicFlags可以 * 仅 * 接受枚举中给定的值(而不是组合)。例如,...
Rust中的enum不打算用作位标志。PublicFlags可以 * 仅 * 接受枚举中给定的值(而不是组合)。例如,...
{ InternalBitFlags: $T, $BitFlags { $( $(#[$inner $($args)*])* const $Flag; )* } } $crate::__impl_public_bitflags_forward! { $BitFlags: $T, InternalBitFlags } $crate::__impl_public_bitflags_ops! { $BitFlags } $crate::__impl_public_bitflags_iter! { $BitFlags: $T, $...
To import the macro, we need to use `#[macro_use]` above the `extern crate` definition: @@ -112,23 +112,23 @@ Now we can model the various flags: ```rust bitflags! { pub flags EntryFlags: u64 { const PRESENT = 1 << 0, const WRITABLE = 1 << 1, const USER_ACCESSIBLE =...
bitflags::bitflags! { pub struct Status : u32 { pub(crate) struct Status : u32 { const ACTIVE = TOKEN::STATUS::RW::ACTIVE; const HALTED = TOKEN::STATUS::RW::HALTED; const DATA_BUFFER_ERROR = TOKEN::STATUS::RW::DATA_BUFFER_ERROR; 0 comments on commit 0a3c8f7 Please sign in ...
pub(crate) fn from_raw_legacy(raw: u32) -> Self { let mut capabilities = CapabilityFlags::from_bits_truncate(u128::from(raw)); if capabilities.bits() != u128::from(raw) { /// Creates a `Capabilities` instance from 128 raw bits. fn from_raw(raw: u128) -> Self { let mut ...
This removes an extern crate and a use so that we always call it via bitflags::bitflags! everywhere. Use bitflags! consistently. … 2bf42c6 Vrixyz approved these changes Jul 12, 2024 View reviewed changes Vrixyz added the D-Easy label Jul 12, 2024 View details Vrixyz merged commit...
/// extern crate bitflags; /// /// bitflags! { /// flags Flags: u32 { /// const FLAG_A = 0b00000001, /// const FLAG_B = 0b00000010, /// const FLAG_C = 0b00000100, /// const FLAG_ABC = FLAG_A.bits /// | FLAG_B.bits ...