Skip to main content

Flags

Struct Flags 

Source
pub struct Flags { /* private fields */ }

Implementations§

Source§

impl Flags

Source

pub open spec fn flags_spec(&self) -> Set<__ghostFlags>

{ Self::flags_from_bits(self.bits()) }
Source

pub open spec fn flags_from_bits(bits: u32) -> Set<__ghostFlags>

{
    ::vstd::set::Set::new(|flag: __ghostFlags| {
        flag.enabled() && (bits & flag.bit()) == flag.bit()
    })
}
Source

pub closed spec fn A_spec() -> Self

Source

pub const exec fn A() -> r : Self

ensures
r.bits() == (0b00000001),
r.flags_spec() == Self::flags_from_bits((0b00000001) as u32),
Source

pub closed spec fn B_spec() -> Self

Source

pub const exec fn B() -> r : Self

ensures
r.bits() == (0b00000010),
r.flags_spec() == Self::flags_from_bits((0b00000010) as u32),
Source

pub closed spec fn C_spec() -> Self

Source

pub const exec fn C() -> r : Self

ensures
r.bits() == (0b00000100),
r.flags_spec() == Self::flags_from_bits((0b00000100) as u32),
Source

pub closed spec fn ABC_spec() -> Self

Source

pub const exec fn ABC() -> r : Self

ensures
r.bits() == (0b00000111),
r.flags_spec() == Self::flags_from_bits((0b00000111) as u32),
Source

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).

Source

pub const exec fn all_bits() -> u32

returns
Self::all_bits(),
Source

pub closed spec fn bits_spec(&self) -> u32

The raw bits stored inside this flags value.

Source

pub const exec fn bits(&self) -> u32

returns
self.bits(),
Source

pub closed spec fn empty_spec() -> Self

Source

pub const exec fn empty() -> r : Self

ensures
r.bits() == 0,
r.flags_spec() == Self::flags_from_bits(0),
returns
Self::empty(),
Source

pub closed spec fn all_spec() -> Self

Source

pub const exec fn all() -> r : Self

ensures
r == Self::all_spec(),
Source

pub open spec fn contains_spec(&self, other: Self) -> bool

{ other@.subset_of(self@) }
Source

pub open spec fn contains_flags_spec(&self, other: Self) -> bool

{ self.contains(other) }
Source

pub const exec fn contains(&self, other: Self) -> bool

returns
self.contains(other),
Source

pub open spec fn intersects_spec(&self, other: Self) -> bool

{ exists |flag: __ghostFlags| #[trigger] self@.contains(flag) && other@.contains(flag) }
Source

pub const exec fn intersects(&self, other: Self) -> bool

returns
self.intersects(other),
Source

pub closed spec fn from_bits_truncate_spec(bits: u32) -> Self

Source

pub closed spec fn from_bits_retain_spec(bits: u32) -> Self

Source

pub const exec fn from_bits_retain(bits: u32) -> r : Self

ensures
r.bits() == bits,
r.flags_spec() == Self::flags_from_bits(bits),
returns
Self::from_bits_retain(bits),
Source

pub const exec fn from_bits_truncate(bits: u32) -> r : Self

returns
Self::from_bits_truncate(bits),
Source

pub closed spec fn from_bits_spec(bits: u32) -> Option<Self>

Source

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)

},
returns
Self::from_bits(bits),
Source

pub closed spec fn remove_spec(self, other: Self) -> Self

Source

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()),
Source

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()),
Source

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.

Source

pub closed spec fn union_spec(self, other: Self) -> Self

Source

pub const exec fn union(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() | other.bits()),
returns
self.union(other),
Source

pub closed spec fn intersection_spec(self, other: Self) -> Self

Source

pub const exec fn intersection(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() & other.bits()),
returns
self.intersection(other),
Source

pub closed spec fn difference_spec(self, other: Self) -> Self

Source

pub const exec fn difference(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() & !other.bits()),
returns
self.difference(other),
Source

pub closed spec fn symmetric_difference_spec(self, other: Self) -> Self

Source

pub const exec fn symmetric_difference(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() ^ other.bits()),
returns
self.symmetric_difference(other),

Trait Implementations§

Source§

impl BitAnd for Flags

Source§

exec fn bitand(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() & other.bits()),
Source§

type Output = Flags

The resulting type after applying the & operator.
Source§

impl BitAndSpecImpl for Flags

Source§

open spec fn obeys_bitand_spec() -> bool

{ true }
Source§

open spec fn bitand_req(self, rhs: Self) -> bool

{ true }
Source§

open spec fn bitand_spec(self, rhs: Self) -> Self::Output

{ self.intersection(rhs) }
Source§

impl BitOr for Flags

Source§

exec fn bitor(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() | other.bits()),
Source§

type Output = Flags

The resulting type after applying the | operator.
Source§

impl BitOrSpecImpl for Flags

Source§

open spec fn obeys_bitor_spec() -> bool

{ true }
Source§

open spec fn bitor_req(self, rhs: Self) -> bool

{ true }
Source§

open spec fn bitor_spec(self, rhs: Self) -> Self::Output

{ self.union(rhs) }
Source§

impl BitXor for Flags

Source§

exec fn bitxor(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() ^ other.bits()),
Source§

type Output = Flags

The resulting type after applying the ^ operator.
Source§

impl BitXorSpecImpl for Flags

Source§

open spec fn obeys_bitxor_spec() -> bool

{ true }
Source§

open spec fn bitxor_req(self, rhs: Self) -> bool

{ true }
Source§

open spec fn bitxor_spec(self, rhs: Self) -> Self::Output

{ self.symmetric_difference(rhs) }
Source§

impl Clone for Flags

Source§

exec fn clone(&self) -> r : Self

ensures
r.bits() == self.bits(),
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Flags

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Not for Flags

Source§

exec fn not(self) -> r : Self

ensures
r.bits() == (!self.bits() & Flags::all_bits()),
Source§

type Output = Flags

The resulting type after applying the ! operator.
Source§

impl NotSpecImpl for Flags

Source§

open spec fn obeys_not_spec() -> bool

{ true }
Source§

open spec fn not_req(self) -> bool

{ true }
Source§

closed spec fn not_spec(self) -> Self::Output

Source§

impl PartialEq for Flags

Source§

exec fn eq(&self, other: &Self) -> r : bool

ensures
r == (self.bits() == other.bits()),
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEqSpecImpl for Flags

Source§

closed spec fn obeys_eq_spec() -> bool

Source§

closed spec fn eq_spec(&self, other: &Self) -> bool

Source§

impl Sub for Flags

Source§

exec fn sub(self, other: Self) -> r : Self

ensures
r.bits() == (self.bits() & !other.bits()),
Source§

type Output = Flags

The resulting type after applying the - operator.
Source§

impl SubSpecImpl for Flags

Source§

open spec fn obeys_sub_spec() -> bool

{ true }
Source§

open spec fn sub_req(self, rhs: Self) -> bool

{ true }
Source§

open spec fn sub_spec(self, rhs: Self) -> Self::Output

{ self.difference(rhs) }
Source§

impl View for Flags

Source§

open spec fn view(&self) -> Self::V

{ Self::flags_from_bits(self.bits()) }
Source§

type V = Set<__ghostFlags>

Source§

impl Copy for Flags

Source§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<Rhs, VERUS_SPEC__A> BitAndSpec<Rhs> for VERUS_SPEC__A
where VERUS_SPEC__A: BitAnd<Rhs> + ?Sized,

§

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
where VERUS_SPEC__A: BitOr<Rhs> + ?Sized,

§

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
where VERUS_SPEC__A: BitXor<Rhs> + ?Sized,

§

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> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

impl<T, U> IntoSpecImpl<U> for T
where U: From<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

§

impl<VERUS_SPEC__A> NotSpec for VERUS_SPEC__A
where VERUS_SPEC__A: Not + ?Sized,

§

fn obeys_not_spec() -> bool

§

fn not_req(self) -> bool

§

fn not_spec(self) -> <VERUS_SPEC__A as Not>::Output

§

impl<A, Rhs> PartialEqIs<Rhs> for A
where A: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

§

fn is_eq(&self, other: &Rhs) -> bool

§

fn is_ne(&self, other: &Rhs) -> bool

§

impl<Rhs, VERUS_SPEC__A> PartialEqSpec<Rhs> for VERUS_SPEC__A
where VERUS_SPEC__A: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

§

fn obeys_eq_spec() -> bool

§

fn eq_spec(&self, other: &Rhs) -> bool

§

impl<Rhs, VERUS_SPEC__A> SubSpec<Rhs> for VERUS_SPEC__A
where VERUS_SPEC__A: Sub<Rhs> + ?Sized,

§

fn obeys_sub_spec() -> bool

§

fn sub_req(self, rhs: Rhs) -> bool

§

fn sub_spec(self, rhs: Rhs) -> <VERUS_SPEC__A as Sub<Rhs>>::Output

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

impl<T, U> TryIntoSpecImpl<U> for T
where U: TryFrom<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<U, <U as TryFrom<T>>::Error>

§

impl<A> SpecEq<&A> for A
where A: ?Sized,

§

impl<A> SpecEq<&mut A> for A
where A: ?Sized,

§

impl<A> SpecEq<A> for A
where A: ?Sized,

§

impl<A> SpecEq<Ghost<A>> for A

§

impl<A> SpecEq<Tracked<A>> for A