Skip to main content

AtomicU16

Struct AtomicU16 

Source
pub struct AtomicU16(/* private fields */);
Expand description

Creusot wrapper around std::sync::atomic::AtomicU16.

Implementations§

Source§

impl AtomicU16

Source

pub fn new( val: u16, view: Ghost<&mut SyncView>, ) -> (Self, Ghost<Box<Perm<AtomicU16>>>)

ensures

*result.1.val() == FMap::singleton(result.0.get_timestamp(^view), (val, **view))

ensures

*result.1.ward() == result.0

terminates

Source

pub fn load<F>(&self, f: Ghost<F>) -> u16
where F: FnGhost + FnOnce(&LoadCommitter<u16, Self>),

Wrapper for std::sync::atomic::AtomicU16::load.

requires

forall<c: &LoadCommitter<$type, Self>> c.ward() == *self ==> f.precondition((c,))

ensures

exists<c: &LoadCommitter<$type, Self>>
    c.ward() == *self && c.val() == result && f.postcondition_once((c,), ())
Source

pub fn store<F>(&self, val: u16, f: Ghost<F>)
where F: FnGhost + FnOnce(&mut StoreCommitter<u16, Self>),

Wrapper for std::sync::atomic::AtomicU16::store.

requires

forall<c: &mut StoreCommitter<$type, Self>> !c.shot() ==> c.ward() == *self ==> c.val() == val ==>
    f.precondition((c,)) && f.postcondition_once((c,), ()) ==> (^c).shot()

ensures

exists<c: &mut StoreCommitter<$type, Self>>
    !c.shot() && c.ward() == *self && c.val() == val &&
    f.postcondition_once((c,), ())

Trait Implementations§

Source§

impl Container for AtomicU16

Source§

fn is_disjoint(&self, _: &Self::Value, other: &Self, _: &Self::Value) -> bool

logic(open, inline)

self != other

Source§

type Value = FMap<Int, (u16, SyncView)>

Source§

impl HasTimestamp for AtomicU16

Source§

fn get_timestamp(self, _: SyncView) -> Timestamp

logic(opaque)

Source§

fn get_timestamp_monotonic(self, x: SyncView, y: SyncView)

logic(law)

requires

x.le_log(y)

ensures

self.get_timestamp(x).le_log(self.get_timestamp(y))

Auto Trait Implementations§

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.

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.

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.
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.