pub struct ArrayPtr<V, const N: usize> {
pub addr: usize,
pub index: usize,
pub _type: PhantomData<[V; N]>,
}Expand description
Concrete representation of a pointer to an array The length of the array is not stored in the pointer
Fields§
§addr: usize§index: usize§_type: PhantomData<[V; N]>Implementations§
Source§impl<V, const N: usize> ArrayPtr<V, N>
impl<V, const N: usize> ArrayPtr<V, N>
Source§impl<V, const N: usize> ArrayPtr<V, N>
impl<V, const N: usize> ArrayPtr<V, N>
Sourcepub exec fn as_mut_ptr(&self, Tracked(perm): Tracked<&PointsTo<V, N>>) -> res : *mut V
pub exec fn as_mut_ptr(&self, Tracked(perm): Tracked<&PointsTo<V, N>>) -> res : *mut V
perm.wf(),perm.is_pptr(*self),self.index < N,ensuresres.addr() == self.addr.wrapping_add(self.index.wrapping_mul(core::mem::size_of::<V>())),Reconstructs a pointer to the selected array element.
Sourcepub exec fn empty() -> (ArrayPtr<V, N>, Tracked<PointsTo<V, N>>)
pub exec fn empty() -> (ArrayPtr<V, N>, Tracked<PointsTo<V, N>>)
layout::size_of::<[V; N]>() > 0,ensuresperm@.wf(),perm@.is_pptr(res),perm@.is_uninit_all(),Sourcepub exec fn make_as(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>, value: V)where
V: Copy,
pub exec fn make_as(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>, value: V)where
V: Copy,
old(perm).wf(),old(perm).is_pptr(*self),old(perm).is_uninit_all(),ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_init_all(),forall |i: int| {
0 <= i < N ==> final(perm).opt_value()[i] == raw_ptr::MemContents::Init(value)
},Sourcepub exec fn new(dft: V) -> (ArrayPtr<V, N>, Tracked<PointsTo<V, N>>)where
V: Copy,
pub exec fn new(dft: V) -> (ArrayPtr<V, N>, Tracked<PointsTo<V, N>>)where
V: Copy,
layout::size_of::<[V; N]>() > 0,ensuresperm@.wf(),perm@.is_pptr(res),forall |i: int| {
0 <= i < N ==> #[trigger] perm@.opt_value()[i] == raw_ptr::MemContents::Init(dft)
},Sourcepub exec fn free(self, Tracked(perm): Tracked<PointsTo<V, N>>)
pub exec fn free(self, Tracked(perm): Tracked<PointsTo<V, N>>)
perm.wf(),perm.is_pptr(self),perm.is_uninit_all(),Sourcepub exec fn insert(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>, value: V)
pub exec fn insert(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>, value: V)
old(perm).wf(),old(perm).is_pptr(*self),old(perm).is_uninit(self.index as int),self.index < N,ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_init(self.index as int),forall |i: int| {
0 <= i < N && i != self.index
==> final(perm).opt_value()[i] == old(perm).opt_value()[i]
},final(perm).opt_value()[self.index as int] == raw_ptr::MemContents::Init(value),Insert value at index
The value is moved into the array.
Requires the slot at index to be uninitialized.
Sourcepub exec fn take_at(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>) -> res : Vwhere
V: Copy,
pub exec fn take_at(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>) -> res : Vwhere
V: Copy,
old(perm).wf(),old(perm).is_pptr(*self),old(perm).is_init(self.index as int),self.index < N,ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_uninit(self.index as int),forall |i: int| {
0 <= i < N && i != self.index
==> final(perm).opt_value()[i] == old(perm).opt_value()[i]
},res == old(perm).opt_value()[self.index as int].value(),Take the value at index
The value is moved out of the array.
Requires the slot at index to be initialized.
Afterwards, the slot is uninitialized.
Sourcepub exec fn take_all(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>) -> res : [V; N]
pub exec fn take_all(&self, Tracked(perm): Tracked<&mut PointsTo<V, N>>) -> res : [V; N]
old(perm).wf(),old(perm).is_pptr(*self),old(perm).is_init_all(),ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_uninit_all(),res@ == old(perm).value(),Take all the values of the array The values are moved out of the array. Requires all slots to be initialized. Afterwards, all slots are uninitialized.
Sourcepub exec fn into_inner(self, Tracked(perm): Tracked<PointsTo<V, N>>) -> res : [V; N]
pub exec fn into_inner(self, Tracked(perm): Tracked<PointsTo<V, N>>) -> res : [V; N]
perm.wf(),perm.is_pptr(self),perm.is_init_all(),ensuresres@ == perm.value(),Free the memory of the entire array and return the value that was previously stored in the array. Requires all slots to be initialized. Afterwards, all slots are uninitialized.
Sourcepub exec fn update(
&self,
Tracked(perm): Tracked<&mut PointsTo<V, N>>,
index: usize,
value: V,
) -> res : Vwhere
V: Copy,
pub exec fn update(
&self,
Tracked(perm): Tracked<&mut PointsTo<V, N>>,
index: usize,
value: V,
) -> res : Vwhere
V: Copy,
old(perm).wf(),old(perm).is_pptr(*self),old(perm).is_init(index as int),index < N,ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_init(index as int),forall |i: int| {
0 <= i < N && i != index ==> final(perm).opt_value()[i] == old(perm).opt_value()[i]
},final(perm).opt_value()[index as int] == raw_ptr::MemContents::Init(value),res == old(perm).opt_value()[index as int].value(),Update the value at index with value and return the previous value
Requires the slot at index to be initialized.
Afterwards, the slot is initialized with value.
Returns the previous value.
Sourcepub exec fn borrow_at<'a>(
&self,
Tracked(perm): Tracked<&'a PointsTo<V, N>>,
index: usize,
) -> res : &'a V
pub exec fn borrow_at<'a>( &self, Tracked(perm): Tracked<&'a PointsTo<V, N>>, index: usize, ) -> res : &'a V
perm.wf(),perm.is_pptr(*self),perm.is_init(index as int),index < N,ensuresres == perm.opt_value()[index as int].value(),Get the reference of the value at index
Borrow the immutable reference of the value at index
Requires the slot at index to be initialized.
Afterwards, the slot is still initialized.
Returns the immutable reference of the value.
The reference is valid as long as the permission is alive.
The reference is not allowed to be stored.
Sourcepub exec fn borrow<'a>(
&self,
Tracked(perm): Tracked<&'a PointsTo<V, N>>,
) -> res : &'a [V; N]
pub exec fn borrow<'a>( &self, Tracked(perm): Tracked<&'a PointsTo<V, N>>, ) -> res : &'a [V; N]
perm.wf(),perm.is_pptr(*self),perm.is_init_all(),ensuresforall |i: int| 0 <= i < N ==> #[trigger] res[i] == perm.opt_value()[i].value(),Get the reference of the entire array Borrow the immutable reference of the entire array Requires all slots to be initialized. Afterwards, all slots are still initialized. Returns the immutable reference of the entire array. The reference is valid as long as the permission is alive. The reference is not allowed to be stored.
Sourcepub exec fn overwrite(
&self,
Tracked(perm): Tracked<&mut PointsTo<V, N>>,
index: usize,
value: V,
)
pub exec fn overwrite( &self, Tracked(perm): Tracked<&mut PointsTo<V, N>>, index: usize, value: V, )
old(perm).wf(),old(perm).is_pptr(*self),index < N,ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_init(index as int),forall |i: int| {
0 <= i < N && i != index ==> final(perm).opt_value()[i] == old(perm).opt_value()[i]
},final(perm).opt_value()[index as int] == raw_ptr::MemContents::Init(value),Overwrite the entry at index with value
The pervious value will be leaked if it was initialized.
Sourcepub proof fn tracked_overwrite(
tracked &self,
tracked perm: &mut PointsTo<V, N>,
tracked index: usize,
tracked value: V,
)
pub proof fn tracked_overwrite( tracked &self, tracked perm: &mut PointsTo<V, N>, tracked index: usize, tracked value: V, )
old(perm).wf(),old(perm).is_pptr(*self),index < N,ensuresfinal(perm).wf(),final(perm).is_pptr(*self),final(perm).is_init(index as int),forall |i: int| {
0 <= i < N && i != index ==> final(perm).opt_value()[i] == old(perm).opt_value()[i]
},final(perm).opt_value()[index as int] == raw_ptr::MemContents::Init(value),Sourcepub exec fn get(&self, Tracked(perm): Tracked<&PointsTo<V, N>>, index: usize) -> res : Vwhere
V: Copy,
pub exec fn get(&self, Tracked(perm): Tracked<&PointsTo<V, N>>, index: usize) -> res : Vwhere
V: Copy,
perm.wf(),perm.is_pptr(*self),perm.is_init(index as int),index < N,ensuresres == perm.opt_value()[index as int].value(),Get the value at index and return it
The value is copied from the array
Requires the slot at index to be initialized.
Afterwards, the slot is still initialized.
Trait Implementations§
impl<V, const N: usize> Copy for ArrayPtr<V, N>
Auto Trait Implementations§
impl<V, const N: usize> Freeze for ArrayPtr<V, N>
impl<V, const N: usize> RefUnwindSafe for ArrayPtr<V, N>where
V: RefUnwindSafe,
impl<V, const N: usize> Send for ArrayPtr<V, N>where
V: Send,
impl<V, const N: usize> Sync for ArrayPtr<V, N>where
V: Sync,
impl<V, const N: usize> Unpin for ArrayPtr<V, N>where
V: Unpin,
impl<V, const N: usize> UnsafeUnpin for ArrayPtr<V, N>
impl<V, const N: usize> UnwindSafe for ArrayPtr<V, N>where
V: UnwindSafe,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
fn obeys_from_spec() -> bool
fn from_spec(v: T) -> VERUS_SPEC__A
§impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> T
§impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> U
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
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) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
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
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<A> SpecEq<&A> for Awhere
A: ?Sized,
impl<A> SpecEq<&mut A> for Awhere
A: ?Sized,
impl<A> SpecEq<A> for Awhere
A: ?Sized,
impl<A> SpecEq<Ghost<A>> for A
impl<A> SpecEq<Tracked<A>> for A
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.