pub struct Flags { /* private fields */ }Implementations§
Source§impl Flags
impl Flags
Sourcepub open spec fn flags_spec(&self) -> Set<__ghostFlags>
pub open spec fn flags_spec(&self) -> Set<__ghostFlags>
{ Self::flags_from_bits(self.bits()) }Sourcepub open spec fn flags_from_bits(bits: u32) -> Set<__ghostFlags>
pub open spec fn flags_from_bits(bits: u32) -> Set<__ghostFlags>
{
::vstd::set::Set::<
__ghostFlags,
>::from_finite_type(|flag: __ghostFlags| {
flag.enabled() && (bits & flag.bit()) == flag.bit()
})
}Sourcepub const exec fn A() -> r : Self
pub const exec fn A() -> r : Self
ensures
r.bits() == (0b00000001),r.flags_spec() == Self::flags_from_bits((0b00000001) as u32),returnsSelf::A_spec(),Sourcepub const exec fn B() -> r : Self
pub const exec fn B() -> r : Self
ensures
r.bits() == (0b00000010),r.flags_spec() == Self::flags_from_bits((0b00000010) as u32),returnsSelf::B_spec(),Sourcepub const exec fn C() -> r : Self
pub const exec fn C() -> r : Self
ensures
r.bits() == (0b00000100),r.flags_spec() == Self::flags_from_bits((0b00000100) as u32),returnsSelf::C_spec(),Sourcepub const exec fn ABC() -> r : Self
pub const exec fn ABC() -> r : Self
ensures
r.bits() == (0b00000111),r.flags_spec() == Self::flags_from_bits((0b00000111) as u32),returnsSelf::ABC_spec(),Sourcepub proof fn lemma_all_constant()
pub proof fn lemma_all_constant()
ensures
Self::all().bits() == Self::all_spec().bits_spec(),Self::all_spec().bits_spec()
== (0 as u32)
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000001) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000010) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000100) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000111) as u32)
} else {
0 as u32
}),Self::all().bits()
== (0 as u32)
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000001) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000010) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000100) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000111) as u32)
} else {
0 as u32
}),Sourcepub broadcast proof fn lemma_consts()
pub broadcast proof fn lemma_consts()
ensures
Self::all().bits()
== (0 as u32)
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000001) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000010) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000100) as u32)
} else {
0 as u32
})
| (if $crate::__bitflags_cfg_expr! {
() true
} {
((0b00000111) as u32)
} else {
0 as u32
}),$crate::__bitflags_cfg_guarded_expr!(() Self::A().bits() == ((0b00000001) as u32)),$crate::__bitflags_cfg_guarded_expr!(() Self::B().bits() == ((0b00000010) as u32)),$crate::__bitflags_cfg_guarded_expr!(() Self::C().bits() == ((0b00000100) as u32)),$crate::__bitflags_cfg_guarded_expr!(() Self::ABC().bits() == ((0b00000111) as u32)),Sourcepub proof fn lemma_from_bits_bits(bits: u32)
pub proof fn lemma_from_bits_bits(bits: u32)
requires
bits & Self::all().bits() == bits,ensuresSelf::from_bits(bits)->0.bits() == bits,Sourcepub proof fn lemma_eq_from_bits(left: Self, right: Self)
pub proof fn lemma_eq_from_bits(left: Self, right: Self)
requires
left.bits() == right.bits(),ensuresleft == right,Sourcepub closed spec fn empty_spec() -> Self
pub closed spec fn empty_spec() -> Self
Sourcepub const exec fn empty() -> r : Self
pub const exec fn empty() -> r : Self
ensures
r.bits() == 0,r.flags_spec() == Self::flags_from_bits(0),returnsSelf::empty(),Sourcepub const exec fn all() -> r : Self
pub const exec fn all() -> r : Self
ensures
r == Self::all_spec(),r.bits() == Self::all().bits(),r.flags_spec() == Self::flags_from_bits(Self::all().bits()),Sourcepub closed spec fn known_bits_spec(&self) -> u32
pub closed spec fn known_bits_spec(&self) -> u32
The bits in self that correspond to declared flags.
Sourcepub const exec fn known_bits(&self) -> r : u32
pub const exec fn known_bits(&self) -> r : u32
returns
self.known_bits(),Sourcepub closed spec fn unknown_bits_spec(&self) -> u32
pub closed spec fn unknown_bits_spec(&self) -> u32
The bits in self that do not correspond to declared flags.
Sourcepub const exec fn unknown_bits(&self) -> r : u32
pub const exec fn unknown_bits(&self) -> r : u32
returns
self.unknown_bits(),Sourcepub open spec fn contains_unknown_bits_spec(&self) -> bool
pub open spec fn contains_unknown_bits_spec(&self) -> bool
{ self.unknown_bits() != 0 }This method returns true if any unknown bits are set.
Sourcepub const exec fn contains_unknown_bits(&self) -> r : bool
pub const exec fn contains_unknown_bits(&self) -> r : bool
returns
self.contains_unknown_bits(),Sourcepub open spec fn is_empty_spec(&self) -> bool
pub open spec fn is_empty_spec(&self) -> bool
{ self.bits() == 0 }Whether all bits in self are unset.
Sourcepub open spec fn is_all_spec(&self) -> bool
pub open spec fn is_all_spec(&self) -> bool
{ Self::all().bits() | self.bits() == self.bits() }Whether all known bits are set.
Sourcepub open spec fn contains_spec(&self, other: Self) -> bool
pub open spec fn contains_spec(&self, other: Self) -> bool
{ (self.bits() & other.bits()) == other.bits() }Whether all set bits in other are also set in self.
Sourcepub open spec fn contains_flags_spec(&self, other: Self) -> bool
pub open spec fn contains_flags_spec(&self, other: Self) -> bool
{ self.contains(other) }Sourcepub open spec fn intersects_spec(&self, other: Self) -> bool
pub open spec fn intersects_spec(&self, other: Self) -> bool
{ (self.bits() & other.bits()) != 0 }Whether any set bits in other are also set in self.
Sourcepub const exec fn intersects(&self, other: Self) -> r : bool
pub const exec fn intersects(&self, other: Self) -> r : bool
returns
self.intersects(other),Sourcepub closed spec fn from_bits_truncate_spec(bits: u32) -> Self
pub closed spec fn from_bits_truncate_spec(bits: u32) -> Self
Sourcepub closed spec fn from_bits_retain_spec(bits: u32) -> Self
pub closed spec fn from_bits_retain_spec(bits: u32) -> Self
Sourcepub const exec fn from_bits_retain(bits: u32) -> r : Self
pub const exec fn from_bits_retain(bits: u32) -> r : Self
ensures
r.bits() == bits,r.flags_spec() == Self::flags_from_bits(bits),returnsSelf::from_bits_retain(bits),Sourcepub exec fn from_name(name: &str) -> r : Option<Self>
pub exec fn from_name(name: &str) -> r : Option<Self>
ensures
r matches Some(
flags_value,
) ==> {
&&& flags_value.flags_spec() == Self::flags_from_bits(flags_value.bits())
},Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const exec fn from_bits_truncate(bits: u32) -> r : Self
pub const exec fn from_bits_truncate(bits: u32) -> r : Self
ensures
r.bits() == (bits & Self::all().bits()),r.flags_spec() == Self::flags_from_bits(bits & Self::all().bits()),returnsSelf::from_bits_truncate(bits),Sourcepub closed spec fn from_bits_spec(bits: u32) -> Option<Self>
pub closed spec fn from_bits_spec(bits: u32) -> Option<Self>
Sourcepub const exec fn from_bits(bits: u32) -> r : Option<Self>
pub const exec fn from_bits(bits: u32) -> r : Option<Self>
ensures
r is Some == ((bits & Self::all().bits()) == bits),r matches Some(
flags_value,
) ==> {
&&& flags_value.bits() == bits
&&& flags_value.flags_spec() == Self::flags_from_bits(bits)
},returnsSelf::from_bits(bits),Sourcepub closed spec fn remove_spec(self, other: Self) -> Self
pub closed spec fn remove_spec(self, other: Self) -> Self
Sourcepub exec fn insert(&mut self, other: Self)
pub exec fn insert(&mut self, other: Self)
ensures
final(self).bits() == (old(self).bits() | other.bits()),final(self).flags_spec() == Self::flags_from_bits(old(self).bits() | other.bits()),Sourcepub exec fn remove(&mut self, other: Self)
pub exec fn remove(&mut self, other: Self)
ensures
*final(self) == old(self).remove_spec(other),final(self).bits() == (old(self).bits() & !other.bits()),final(self).flags_spec() == Self::flags_from_bits(old(self).bits() & !other.bits()),Sourcepub exec fn toggle(&mut self, other: Self)
pub exec fn toggle(&mut self, other: Self)
ensures
final(self).bits() == (old(self).bits() ^ other.bits()),final(self).flags_spec() == Self::flags_from_bits(old(self).bits() ^ other.bits()),The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub exec fn set(&mut self, other: Self, value: bool)
pub exec fn set(&mut self, other: Self, value: bool)
ensures
value ==> final(self).bits() == (old(self).bits() | other.bits()),!value ==> final(self).bits() == (old(self).bits() & !other.bits()),Call insert when value is true or remove when value is false.
Sourcepub exec fn truncate(&mut self)
pub exec fn truncate(&mut self)
ensures
final(self).bits() == (old(self).bits() & Self::all().bits()),final(self).flags_spec() == Self::flags_from_bits(old(self).bits() & Self::all().bits()),Remove any unknown bits from the flags.
Sourcepub exec fn clear(&mut self)
pub exec fn clear(&mut self)
ensures
final(self).bits() == 0,final(self).flags_spec() == Self::flags_from_bits(0),Unsets all bits in the flags.
Sourcepub closed spec fn union_spec(self, other: Self) -> Self
pub closed spec fn union_spec(self, other: Self) -> Self
Sourcepub const exec fn union(self, other: Self) -> r : Self
pub const exec fn union(self, other: Self) -> r : Self
ensures
r.bits() == (self.bits() | other.bits()),returnsself.union(other),Sourcepub closed spec fn intersection_spec(self, other: Self) -> Self
pub closed spec fn intersection_spec(self, other: Self) -> Self
Sourcepub const exec fn intersection(self, other: Self) -> r : Self
pub const exec fn intersection(self, other: Self) -> r : Self
ensures
r.bits() == (self.bits() & other.bits()),returnsself.intersection(other),Sourcepub closed spec fn difference_spec(self, other: Self) -> Self
pub closed spec fn difference_spec(self, other: Self) -> Self
Sourcepub const exec fn difference(self, other: Self) -> r : Self
pub const exec fn difference(self, other: Self) -> r : Self
ensures
r.bits() == (self.bits() & !other.bits()),returnsself.difference(other),Sourcepub closed spec fn symmetric_difference_spec(self, other: Self) -> Self
pub closed spec fn symmetric_difference_spec(self, other: Self) -> Self
Sourcepub const exec fn symmetric_difference(self, other: Self) -> r : Self
pub const exec fn symmetric_difference(self, other: Self) -> r : Self
ensures
r.bits() == (self.bits() ^ other.bits()),returnsself.symmetric_difference(other),Sourcepub closed spec fn complement_spec(self) -> Self
pub closed spec fn complement_spec(self) -> Self
Sourcepub const exec fn complement(self) -> r : Self
pub const exec fn complement(self) -> r : Self
ensures
r.bits() == (!self.bits() & Self::all().bits()),r.flags_spec() == Self::flags_from_bits(!self.bits() & Self::all().bits()),returnsself.complement(),Trait Implementations§
Source§impl BitAndAssign for Flags
impl BitAndAssign for Flags
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the
&= operation. Read moreSource§impl BitAndSpecImpl for Flags
impl BitAndSpecImpl for Flags
Source§open spec fn obeys_bitand_spec() -> bool
open spec fn obeys_bitand_spec() -> bool
{ true }Source§open spec fn bitand_req(self, rhs: Self) -> bool
open spec fn bitand_req(self, rhs: Self) -> bool
{ true }Source§open spec fn bitand_spec(self, rhs: Self) -> Self::Output
open spec fn bitand_spec(self, rhs: Self) -> Self::Output
{ self.intersection(rhs) }Source§impl BitOrAssign for Flags
impl BitOrAssign for Flags
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the
|= operation. Read moreSource§impl BitXorAssign for Flags
impl BitXorAssign for Flags
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Performs the
^= operation. Read moreSource§impl BitXorSpecImpl for Flags
impl BitXorSpecImpl for Flags
Source§open spec fn obeys_bitxor_spec() -> bool
open spec fn obeys_bitxor_spec() -> bool
{ true }Source§open spec fn bitxor_req(self, rhs: Self) -> bool
open spec fn bitxor_req(self, rhs: Self) -> bool
{ true }Source§open spec fn bitxor_spec(self, rhs: Self) -> Self::Output
open spec fn bitxor_spec(self, rhs: Self) -> Self::Output
{ self.symmetric_difference(rhs) }Source§impl SubAssign for Flags
impl SubAssign for Flags
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreimpl Copy for Flags
impl Eq for Flags
Auto Trait Implementations§
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnsafeUnpin for Flags
impl UnwindSafe for Flags
Blanket Implementations§
§impl<Rhs, VERUS_SPEC__A> BitAndSpec<Rhs> for VERUS_SPEC__A
impl<Rhs, VERUS_SPEC__A> BitAndSpec<Rhs> for VERUS_SPEC__A
fn obeys_bitand_spec() -> bool
fn bitand_req(self, rhs: Rhs) -> bool
fn bitand_spec(self, rhs: Rhs) -> <VERUS_SPEC__A as BitAnd<Rhs>>::Output
§impl<Rhs, VERUS_SPEC__A> BitOrSpec<Rhs> for VERUS_SPEC__A
impl<Rhs, VERUS_SPEC__A> BitOrSpec<Rhs> for VERUS_SPEC__A
fn obeys_bitor_spec() -> bool
fn bitor_req(self, rhs: Rhs) -> bool
fn bitor_spec(self, rhs: Rhs) -> <VERUS_SPEC__A as BitOr<Rhs>>::Output
§impl<Rhs, VERUS_SPEC__A> BitXorSpec<Rhs> for VERUS_SPEC__A
impl<Rhs, VERUS_SPEC__A> BitXorSpec<Rhs> for VERUS_SPEC__A
fn obeys_bitxor_spec() -> bool
fn bitxor_req(self, rhs: Rhs) -> bool
fn bitxor_spec(self, rhs: Rhs) -> <VERUS_SPEC__A as BitXor<Rhs>>::Output
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more