pub struct FlagVec(/* private fields */);
Expand description
Bit flag vector. Can hold up to 2^16-1 flags and guaranteed to have length up to 255 bytes.
Implementations§
source§impl FlagVec
impl FlagVec
sourcepub fn with_capacity(upto: FlagNo) -> Self
pub fn with_capacity(upto: FlagNo) -> Self
Constructs a features vector of upto
feature flag in unset state
sourcepub fn count_flags(&self) -> u16
pub fn count_flags(&self) -> u16
Counts number of flags set
sourcepub fn from_inner(vec: TinyVec<u8>) -> Self
pub fn from_inner(vec: TinyVec<u8>) -> Self
Constructs flags from the inner representation in form of TinyVec
.
sourcepub fn as_inner(&mut self) -> &TinyVec<u8>
pub fn as_inner(&mut self) -> &TinyVec<u8>
Returns byte slice representation of the inner TinyVec
.
Shrinks the inner data.
sourcepub fn into_inner(self) -> TinyVec<u8>
pub fn into_inner(self) -> TinyVec<u8>
Returns byte slice representation of the inner TinyVec
sourcepub fn iter(&self) -> AllSet<'_> ⓘ
pub fn iter(&self) -> AllSet<'_> ⓘ
Creates an iterator for the current feature flags which have “set” state
sourcepub fn known_iter(&self, known: FlagVec) -> FilteredIter<'_> ⓘ
pub fn known_iter(&self, known: FlagVec) -> FilteredIter<'_> ⓘ
Creates iterator over known set of the features
sourcepub fn unknown_iter(&self, known: FlagVec) -> FilteredIter<'_> ⓘ
pub fn unknown_iter(&self, known: FlagVec) -> FilteredIter<'_> ⓘ
Creates iterator over unknown set of the features, i.e. features that
do not match flags set in known
parameter
sourcepub fn shrink(&mut self) -> bool
pub fn shrink(&mut self) -> bool
Reduces the size of the internal buffer to the smallest capacity
required to keep all currently set feature flags. Returns true
if
resize operation was required, or false
otherwise, when the internal
buffer already was of the smallest possible size
sourcepub fn is_set(&self, flag_no: FlagNo) -> bool
pub fn is_set(&self, flag_no: FlagNo) -> bool
Returns whether a feature flag with flag_no
is set (true
or false
)
sourcepub fn set(&mut self, flag_no: FlagNo) -> bool
pub fn set(&mut self, flag_no: FlagNo) -> bool
Sets the feature flag with number flag_no
. Returns true
if the flag
was already set and false
otherwise (i.e. previous value of the flag)
Trait Implementations§
source§impl Ord for FlagVec
impl Ord for FlagVec
source§impl PartialEq for FlagVec
impl PartialEq for FlagVec
source§impl PartialOrd for FlagVec
impl PartialOrd for FlagVec
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more