Skip to main content

CursorOwner

Struct CursorOwner 

Source
pub struct CursorOwner<M: AnyFrameMeta + Repr<MetaSlotSmall>> {
    pub list_own: LinkedListOwner<M>,
    pub index: int,
}

Fields§

§list_own: LinkedListOwner<M>§index: int

Implementations§

Source§

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

Source

pub open spec fn length(self) -> int

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

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

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

}

Region-based analog of CursorOwner::inv: replaces list_own.inv() (over the owned perms) with list_own.relate_region(regions) (over the region permissions).

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 open spec fn list_insert( cursor: Self, link: LinkOwner, repr_perm: LinkInnerPerms<M>, metadata_perms: MetadataPerm, list_id: u64, ) -> (Self, LinkOwner)

{
    let link = LinkOwner {
        paddr: link.paddr,
        in_list: list_id,
    };
    (
        Self {
            list_own: LinkedListOwner::<M> {
                list: cursor.list_own.list.insert(cursor.index, link),
                repr_perms: cursor.list_own.repr_perms.insert(cursor.index, repr_perm),
                metadata_perms: cursor
                    .list_own
                    .metadata_perms
                    .insert(cursor.index, metadata_perms),
                list_id,
                _marker: PhantomData,
            },
            index: cursor.index + 1,
        },
        link,
    )
}
Source

pub proof fn tracked_list_insert( tracked cursor: &mut Self, tracked link: &mut LinkOwner, tracked repr_perm: LinkInnerPerms<M>, tracked metadata_perms: MetadataPerm, list_id: u64, )

requires
list_id != 0,
0 <= old(cursor).index <= old(cursor).list_own.list.len(),
old(cursor).list_own.repr_perms.len() == old(cursor).list_own.list.len(),
old(cursor).list_own.metadata_perms.len() == old(cursor).list_own.list.len(),
old(cursor).list_own.list.len() > 0 ==> list_id == old(cursor).list_own.list_id,
old(cursor).list_own.list_id != 0 ==> list_id == old(cursor).list_own.list_id,
ensures
({
    let res = Self::list_insert(
        *old(cursor),
        *old(link),
        repr_perm,
        metadata_perms,
        list_id,
    );
    res.0 == *final(cursor) && res.1 == *final(link)
}),

Tracked update to the cursor’s owner state when a new link is inserted before the current position. The inserted link’s paddr is unchanged and its in_list is stamped with list_id — the (non-zero) id the concrete lazy_get_id resolved. The cursor’s list gains link at old.index, adopts list_id (which equals the old id when that was already non-zero), and index advances by one. In the borrow model, the link’s tracked permission remains parked in MetaRegionOwners.slots; this axiom doesn’t need to take or carry a perm.

Source

pub open spec fn front_owner(list_own: LinkedListOwner<M>) -> Self

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

pub open spec fn cursor_mut_at_owner(list_own: LinkedListOwner<M>, index: int) -> Self

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

pub proof fn tracked_cursor_mut_at_owner( tracked list_own: LinkedListOwner<M>, index: int, ) -> tracked Self

returns
Self::cursor_mut_at_owner(list_own, index),
Source

pub proof fn tracked_front_owner(tracked list_own: LinkedListOwner<M>) -> tracked Self

returns
Self::front_owner(list_own),
Source

pub open spec fn back_owner(list_own: LinkedListOwner<M>) -> Self

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

pub proof fn tracked_back_owner(tracked list_own: LinkedListOwner<M>) -> tracked res : Self

ensures
res == Self::back_owner(list_own),
Source§

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

Source

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

{
    &&& 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),
0 <= self.index < self.length(),
ensures
post@ == self@.remove(),
Source

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

{
    &&& post.list_own.list == self.list_own.list.insert(self.index, link)
    &&& 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),
0 <= self.index <= self.length(),
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,
            index: 0,
        }
    } else if self.index == self.length() - 1 {
        Self {
            list_own: self.list_own,
            index: self.index + 1,
        }
    } else {
        Self {
            list_own: self.list_own,
            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,
            index: self.index - 1,
        }
    } else if self.index == 0 {
        Self {
            list_own: self.list_own,
            index: self.length(),
        }
    } else {
        Self {
            list_own: self.list_own,
            index: self.index - 1,
        }
    }
}

Trait Implementations§

Source§

impl<M: AnyFrameMeta + Repr<MetaSlotSmall>> 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<MetaSlotSmall>> InvView for CursorOwner<M>

Source§

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

Source§

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

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

type V = CursorModel

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for CursorOwner<M>

§

impl<M> Freeze for CursorOwner<M>

§

impl<M> Send for CursorOwner<M>
where <M as Repr<MetaSlotSmall>>::ReprPerm: Send,

§

impl<M> Sync for CursorOwner<M>
where <M as Repr<MetaSlotSmall>>::ReprPerm: Sync,

§

impl<M> Unpin for CursorOwner<M>
where M: Unpin, <M as Repr<MetaSlotSmall>>::ReprPerm: Unpin,

§

impl<M> UnsafeUnpin for CursorOwner<M>

§

impl<M> UnwindSafe for CursorOwner<M>

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
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. 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

§

impl<T> FromSpecImpl<T> for T

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> T

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

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

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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>