Skip to main content

NonNullAdditionalFns

Trait NonNullAdditionalFns 

Source
pub trait NonNullAdditionalFns<T: PointeeSized> {
    // Required methods
    spec fn view_ptr_mut(self) -> *mut T;
    spec fn cast_spec<U>(self) -> NonNull<U>;
    spec fn dangling_spec() -> NonNull<T>;
    broadcast proof fn lemma_addr_is_nonnull(self);
    spec fn addr_spec(self) -> NonZeroUsize;
    broadcast proof fn lemma_addr_view_eq_view_ptr_mut(self);
}

Required Methods§

Source

spec fn view_ptr_mut(self) -> *mut T

Source

spec fn cast_spec<U>(self) -> NonNull<U>

Specification for NonNull::cast.

Source

spec fn dangling_spec() -> NonNull<T>

Specification for NonNull::dangling().

Source

broadcast proof fn lemma_addr_is_nonnull(self)

ensures
!(#[trigger] self.view_ptr_mut()).is_null(),

Type invariant: the address of the pointer is non-null.

Source

spec fn addr_spec(self) -> NonZeroUsize

Source

broadcast proof fn lemma_addr_view_eq_view_ptr_mut(self)

ensures
(#[trigger] self.addr_spec()).view() == self.view_ptr_mut().addr(),

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: PointeeSized> NonNullAdditionalFns<T> for NonNull<T>

Source§

uninterp spec fn view_ptr_mut(self) -> *mut T

Source§

uninterp spec fn cast_spec<U>(self) -> NonNull<U>

Source§

uninterp spec fn dangling_spec() -> NonNull<T>

Source§

proof fn lemma_addr_is_nonnull(self)

Source§

open spec fn addr_spec(self) -> NonZeroUsize

{ nonzero_from_primitive(self.view_ptr_mut()@.addr) }
Source§

proof fn lemma_addr_view_eq_view_ptr_mut(self)

Implementors§