Skip to main content

UniqueFrameOwner

Struct UniqueFrameOwner 

Source
pub struct UniqueFrameOwner<M: AnyFrameMeta + ?Sized + Repr<MetaSlotStorage> + OwnerOf> {
    pub meta_own: M::Owner,
    pub repr_perm: Option<M::ReprPerm>,
    pub slot_index: int,
}

Fields§

§meta_own: M::Owner§repr_perm: Option<M::ReprPerm>§slot_index: int

Implementations§

Source§

impl<M: AnyFrameMeta + Repr<MetaSlotSmall>> UniqueFrameOwner<Link<M>>

{
    &&& self.meta_value(regions).prev is None
    &&& self.meta_value(regions).next is None
    &&& self.meta_own.paddr == regions.slots[self.slot_index].addr()
    &&& regions.slot_owners[self.slot_index].in_list_perm.value() == 0

}
Source§

impl<M: AnyFrameMeta + Repr<MetaSlotStorage> + OwnerOf> UniqueFrameOwner<M>

Source

pub open spec fn meta_wf(self, regions: MetaRegionOwners) -> bool

{
    typed_meta_wf::<
        M,
    >(
        *regions.slots[self.slot_index],
        regions.slot_owners[self.slot_index].metadata_perm,
        self.repr_perm->0,
    )
}
Source

pub open spec fn meta_value(self, regions: MetaRegionOwners) -> M

{
    typed_meta_value::<
        M,
    >(regions.slot_owners[self.slot_index].metadata_perm, self.repr_perm->0)
}
Source

pub open spec fn perm_inv(self, perm: PointsTo<MetaSlot>) -> bool

{
    &&& perm.is_init()
    &&& perm.addr() == index_to_meta(self.slot_index)

}
Source

pub open spec fn global_inv(self, regions: MetaRegionOwners) -> bool

{
    &&& regions.contains(self.slot_index)
    &&& self.meta_wf(regions)
    &&& regions.slots[self.slot_index].addr() == index_to_meta(self.slot_index)
    &&& self.meta_value(regions).wf(self.meta_own)
    &&& regions.slot_owners[self.slot_index].slot_vaddr == index_to_meta(self.slot_index)
    &&& regions.slot_owners[self.slot_index].ref_count() == REF_COUNT_UNIQUE
    &&& regions.slot_owners[self.slot_index].usage is Frame
    &&& regions.frame_obligations.count(self.slot_index) > 0

}

Borrow-model global invariant: the frame’s permission is parked in regions.slots[slot_index] (NOT owned by the frame), and the concrete storage and representation permissions decode to metadata matching meta_own. A UniqueFrame is the sole live reference to its slot, so the slot sits at REF_COUNT_UNIQUE — the unique-frame analog of the segment’s 0 < ref_count <= REF_COUNT_MAX regime in Segment::relate_regions. Being live, it also owes a pending-Drop obligation in frame_obligations (minted at from_unused/from_raw, consumed by drop/into_raw).

Source

pub open spec fn from_unused_owner( meta_own: M::Owner, repr_perm: M::ReprPerm, slot_index: int, ) -> Self

{
    Self {
        meta_own,
        repr_perm: Some(repr_perm),
        slot_index,
    }
}
Source

pub proof fn tracked_from_unused_owner( tracked meta_own: M::Owner, tracked repr_perm: M::ReprPerm, slot_index: int, ) -> tracked res : Self

returns
Self::from_unused_owner(meta_own, repr_perm, slot_index),
Source

pub proof fn tracked_borrow_repr_perm(tracked &self) -> tracked res : &M::ReprPerm

requires
self.repr_perm is Some,
ensures
*res == self.repr_perm->0,
Source

pub proof fn tracked_borrow_mut_repr_perm(tracked &mut self) -> tracked res : &mut M::ReprPerm

requires
old(self).inv(),
ensures
*res == old(self).repr_perm->0,
final(self).meta_own == old(self).meta_own,
final(self).slot_index == old(self).slot_index,
final(self).repr_perm is Some,
final(self).repr_perm->0 == *final(res),
final(self).inv(),

Trait Implementations§

Source§

impl<M: AnyFrameMeta + ?Sized + Repr<MetaSlotStorage> + OwnerOf> Inv for UniqueFrameOwner<M>

Source§

open spec fn inv(self) -> bool

{
    &&& 0 <= self.slot_index < MAX_NR_PAGES
    &&& self.slot_index < max_meta_slots()
    &&& self.repr_perm is Some

}
Source§

impl<M: AnyFrameMeta + Repr<MetaSlotStorage> + OwnerOf> InvView for UniqueFrameOwner<M>

Source§

impl<M: AnyFrameMeta + ?Sized + Repr<MetaSlotStorage> + OwnerOf> View for UniqueFrameOwner<M>

Source§

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

{
    UniqueFrameModel {
        meta: self.meta_own@,
    }
}
Source§

type V = UniqueFrameModel<M>

Auto Trait Implementations§

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

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