pub struct PointsTo<T> { /* private fields */ }
Expand description
Permission to access possibly-initialized, typed memory.
Implementations§
Source§impl<T> PointsTo<T>
impl<T> PointsTo<T>
Sourcepub open spec fn ptr(&self) -> *mut T
pub open spec fn ptr(&self) -> *mut T
{ self.view().ptr }
The pointer that this permission is associated with.
Sourcepub open spec fn opt_value(&self) -> MemContents<T>
pub open spec fn opt_value(&self) -> MemContents<T>
{ self.view().opt_value }
The (possibly uninitialized) memory that this permission gives access to.
Sourcepub open spec fn is_init(&self) -> bool
pub open spec fn is_init(&self) -> bool
{ self.opt_value().is_init() }
Returns true
if the permission’s associated memory is initialized.
Sourcepub open spec fn is_uninit(&self) -> bool
pub open spec fn is_uninit(&self) -> bool
{ self.opt_value().is_uninit() }
Returns true
if the permission’s associated memory is uninitialized.
Sourcepub open spec fn value(&self) -> T
pub open spec fn value(&self) -> T
self.is_init(),
{ self.opt_value().value() }
If the permission’s associated memory is initialized, returns the value that the pointer points to. Otherwise, the result is meaningless.
Sourcepub proof fn is_nonnull(tracked &self)
pub proof fn is_nonnull(tracked &self)
size_of::<T>() != 0,
ensuresself@.ptr@.addr != 0,
Guarantee that the PointsTo
for any non-zero-sized type points to a non-null address.
Sourcepub proof fn leak_contents(tracked &mut self)
pub proof fn leak_contents(tracked &mut self)
self.ptr() == old(self).ptr(),
self.is_uninit(),
“Forgets” about the value stored behind the pointer.
Updates the PointsTo
value to MemContents::Uninit
.
Note that this is a proof
function, i.e.,
it is operationally a no-op in executable code, even on the Rust Abstract Machine.
Only the proof-code representation changes.
Sourcepub proof fn is_disjoint<S>(tracked &mut self, tracked other: &PointsTo<S>)
pub proof fn is_disjoint<S>(tracked &mut self, tracked other: &PointsTo<S>)
*old(self) == *self,
self.ptr() as int + size_of::<T>() <= other.ptr() as int
|| other.ptr() as int + size_of::<S>() <= self.ptr() as int,
Guarantees that the memory ranges associated with two permissions will not overlap, since you cannot have two permissions to the same memory.
Note: If both S and T are non-zero-sized, then this implies the pointers have distinct addresses.
Source§impl<V> PointsTo<V>
impl<V> PointsTo<V>
Sourcepub proof fn into_raw(tracked self) -> tracked points_to_raw : PointsToRaw
pub proof fn into_raw(tracked self) -> tracked points_to_raw : PointsToRaw
self.is_uninit(),
ensurespoints_to_raw.is_range(self.ptr().addr() as int, size_of::<V>() as int),
points_to_raw.provenance() == self.ptr()@.provenance,
Creates a PointsToRaw
from a PointsTo<V>
with the same provenance
and a range corresponding to the address of the PointsTo<V>
and size of V
,
provided that the memory tracked by the PointsTo<V>
is uninitialized.