CursorOwner

Struct CursorOwner 

Source
pub struct CursorOwner<M: AnyFrameMeta + Repr<MetaSlot>> {
    pub list_own: LinkedListOwner<M>,
    pub list_perm: PointsTo<LinkedList<M>>,
    pub index: int,
}

Fields§

§list_own: LinkedListOwner<M>§list_perm: PointsTo<LinkedList<M>>§index: int

Implementations§

Source§

impl<M: AnyFrameMeta + Repr<MetaSlot>> CursorOwner<M>

Source

pub open spec fn length(self) -> int

{ self.list_own.list.len() as int }
Source

pub open spec fn current(self) -> Option<LinkOwner>

{
    if 0 <= self.index < self.length() {
        Some(self.list_own.list[self.index])
    } else {
        None
    }
}
Source

pub exec fn list_insert( verus_tmp_cursor: Tracked<&mut Self>, verus_tmp_link: Tracked<&mut LinkOwner>, verus_tmp_perm: Tracked<&PointsTo<MetaSlot, Link<M>>>, )

ensures
cursor.list_own.list == old(cursor).list_own.list.insert(old(cursor).index, *old(link)),
cursor.list_own.list_id == old(cursor).list_own.list_id,
forall |idx: int| 0 <= idx < cursor.length() ==> cursor.list_own.perms.contains_key(idx),
forall |idx: int| {
    0 <= idx < cursor.index
        ==> cursor.list_own.perms[idx] == old(cursor).list_own.perms[idx]
},
forall |idx: int| {
    old(cursor).index < idx <= old(cursor).length()
        ==> cursor.list_own.perms[idx] == old(cursor).list_own.perms[idx - 1]
},
cursor.list_own.perms[old(cursor).index] == perm,
cursor.index == old(cursor).index + 1,
cursor.list_perm == old(cursor).list_perm,
*link == *old(link),
Source

pub open spec fn front_owner_spec( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> Self

{
    CursorOwner::<M> {
        list_own: list_own,
        list_perm: list_perm,
        index: 0,
    }
}
Source

pub proof fn front_owner( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> res : Self

ensures
res == Self::front_owner_spec(list_own, list_perm),
Source

pub open spec fn back_owner_spec( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> Self

{
    CursorOwner::<M> {
        list_own: list_own,
        list_perm: list_perm,
        index: if list_own.list.len() > 0 { list_own.list.len() as int - 1 } else { 0 },
    }
}
Source

pub proof fn back_owner( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> res : Self

ensures
res == Self::back_owner_spec(list_own, list_perm),
Source

pub open spec fn ghost_owner_spec( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> Self

{
    CursorOwner::<M> {
        list_own: list_own,
        list_perm: list_perm,
        index: list_own.list.len() as int,
    }
}
Source

pub proof fn ghost_owner( list_own: LinkedListOwner<M>, list_perm: PointsTo<LinkedList<M>>, ) -> res : Self

ensures
res == Self::ghost_owner_spec(list_own, list_perm),
Source§

impl<M: AnyFrameMeta + Repr<MetaSlot>> CursorOwner<M>

Source

pub open spec fn remove_owner_spec(self, post: Self) -> bool

recommends
self.index < self.length(),
{
    &&& post.list_own.list == self.list_own.list.remove(self.index)
    &&& post.index == self.index

}
Source

pub proof fn remove_owner_spec_implies_model_spec(self, post: Self)

requires
self.remove_owner_spec(post),
ensures
post@ == self@.remove(),
Source

pub open spec fn insert_owner_spec(self, link: LinkOwner, post: Self) -> bool

recommends
self.index < self.length(),
{
    &&& post.list_own.list == self.list_own.list.insert(self.index, link)
    &&& post.list_own.list_id == self.list_own.list_id
    &&& post.index == self.index + 1

}
Source

pub proof fn insert_owner_spec_implies_model_spec(self, link: LinkOwner, post: Self)

requires
self.insert_owner_spec(link, post),
ensures
post@ == self@.insert(link@),
Source

pub open spec fn move_next_owner_spec(self) -> Self

{
    if self.length() == 0 {
        self
    } else if self.index == self.length() {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: 0,
        }
    } else if self.index == self.length() - 1 {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: self.index + 1,
        }
    } else {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: self.index + 1,
        }
    }
}
Source

pub open spec fn move_prev_owner_spec(self) -> Self

{
    if self.length() == 0 {
        self
    } else if self.index == self.length() {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: self.index - 1,
        }
    } else if self.index == 0 {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: self.length(),
        }
    } else {
        Self {
            list_own: self.list_own,
            list_perm: self.list_perm,
            index: self.index - 1,
        }
    }
}

Trait Implementations§

Source§

impl<M: AnyFrameMeta + Repr<MetaSlot>> Inv for CursorOwner<M>

Source§

open spec fn inv(self) -> bool

{
    &&& 0 <= self.index <= self.length()
    &&& self.list_own.inv()

}
Source§

impl<M: AnyFrameMeta + Repr<MetaSlot>> InvView for CursorOwner<M>

Source§

impl<M: AnyFrameMeta + Repr<MetaSlot>> View for CursorOwner<M>

Source§

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

{
    let list = self.list_own.view();
    CursorModel {
        fore: list.list.take(self.index),
        rear: list.list.skip(self.index),
        list_model: list,
    }
}
Source§

type V = CursorModel

Auto Trait Implementations§

§

impl<M> Freeze for CursorOwner<M>

§

impl<M> !RefUnwindSafe for CursorOwner<M>

§

impl<M> Send for CursorOwner<M>
where M: Send,

§

impl<M> Sync for CursorOwner<M>
where M: Sync,

§

impl<M> Unpin for CursorOwner<M>
where M: Unpin,

§

impl<M> UnwindSafe for CursorOwner<M>
where M: UnwindSafe,

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>