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::new(|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),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),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),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),Sourcepub open spec fn all_bits_spec() -> u32
pub open spec fn all_bits_spec() -> u32
{
(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
})
}The bitwise OR of every declared flag (the “all” bits mask).
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 open spec fn contains_spec(&self, other: Self) -> bool
pub open spec fn contains_spec(&self, other: Self) -> bool
{ other@.subset_of(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
{ exists |flag: __ghostFlags| #[trigger] self@.contains(flag) && other@.contains(flag) }Sourcepub const exec fn intersects(&self, other: Self) -> bool
pub const exec fn intersects(&self, other: Self) -> 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 const exec fn from_bits_truncate(bits: u32) -> r : Self
pub const exec fn from_bits_truncate(bits: u32) -> r : Self
returns
Self::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 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),Trait Implementations§
Source§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 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) }impl 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