pub struct AtomicI16(/* private fields */);Expand description
Creusot wrapper around [std::sync::atomic::$atomic_type]
Creusot wrapper around std::sync::atomic::AtomicI16.
Implementations§
Source§impl AtomicI16
impl AtomicI16
Sourcepub fn new(val: i16) -> (Self, Ghost<Perm<AtomicI16>>)
pub fn new(val: i16) -> (Self, Ghost<Perm<AtomicI16>>)
ensures
result.1.val() == valensures
*result.1.ward() == result.0terminates
Sourcepub fn into_inner(self, own: Ghost<Perm<AtomicI16>>) -> i16
pub fn into_inner(self, own: Ghost<Perm<AtomicI16>>) -> i16
Wrapper for std::sync::atomic::AtomicI16::into_inner.
requires
self == *own.ward()ensures
result == own.val()Sourcepub fn compare_exchange<F>(
&self,
current: i16,
new: i16,
f: Ghost<F>,
) -> Result<i16, i16>
pub fn compare_exchange<F>( &self, current: i16, new: i16, f: Ghost<F>, ) -> Result<i16, i16>
Wrapper for std::sync::atomic::AtomicI16::compare_exchange.
The load and the store are always sequentially consistent.
requires
forall<c: &mut Committer<Self, $type, SeqCst, SeqCst>> !c.shot_store() ==> c.ward() == *self ==> c.val_load().deep_model() == current.deep_model() ==> c.val_store() == new ==> f.precondition((Ok(c),)) && (f.postcondition_once((Ok(c),), ()) ==> (^c).shot_store())
requires
forall<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() ==> c.ward() == *self ==> // NOTE: This following line is not present for `weak` c.val_load().deep_model() != current.deep_model() ==> f.precondition((Err(c),))
ensures
match result { Ok(result) => { exists<c: &mut Committer<Self, $type, SeqCst, SeqCst>> !c.shot_store() && c.ward() == *self && c.val_load().deep_model() == current.deep_model() && c.val_store() == new && result == c.val_load() && f.postcondition_once((Ok(c),), ()) }, Err(result) => { exists<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() && c.ward() == *self && // NOTE: This following line is not present for `weak` c.val_load().deep_model() != current.deep_model() && result == c.val_load() && f.postcondition_once((Err(c),), ()) } }
Sourcepub fn compare_exchange_weak<F>(
&self,
current: i16,
new: i16,
f: Ghost<F>,
) -> Result<i16, i16>
pub fn compare_exchange_weak<F>( &self, current: i16, new: i16, f: Ghost<F>, ) -> Result<i16, i16>
Wrapper for std::sync::atomic::AtomicI16::compare_exchange_weak.
The load and the store are always sequentially consistent.
requires
forall<c: &mut Committer<Self, $type, SeqCst, SeqCst>> !c.shot_store() ==> c.ward() == *self ==> c.val_load().deep_model() == current.deep_model() ==> c.val_store() == new ==> f.precondition((Ok(c),)) && (f.postcondition_once((Ok(c),), ()) ==> (^c).shot_store())
requires
forall<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() ==> c.ward() == *self ==> f.precondition((Err(c),))
ensures
match result { Ok(result) => { exists<c: &mut Committer<Self, $type, SeqCst, SeqCst>> !c.shot_store() && c.ward() == *self && c.val_load().deep_model() == current.deep_model() && c.val_store() == new && result == c.val_load() && f.postcondition_once((Ok(c),), ()) }, Err(result) => { exists<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() && c.ward() == *self && result == c.val_load() && f.postcondition_once((Err(c),), ()) } }
Sourcepub fn load<F>(&self, f: Ghost<F>) -> i16
pub fn load<F>(&self, f: Ghost<F>) -> i16
Wrapper for std::sync::atomic::AtomicI16::load.
The load is always sequentially consistent.
requires
forall<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() ==> c.ward() == *self ==> f.precondition((c,))
ensures
exists<c: &Committer<Self, $type, SeqCst, ()>> !c.shot_store() && c.ward() == *self && c.val_load() == result && f.postcondition_once((c,), ())
Sourcepub fn store<F>(&self, val: i16, f: Ghost<F>)
pub fn store<F>(&self, val: i16, f: Ghost<F>)
Wrapper for std::sync::atomic::AtomicI16::store.
The store is always sequentially consistent.
requires
forall<c: &mut Committer<Self, $type, (), SeqCst>> !c.shot_store() ==> c.ward() == *self ==> c.val_store() == val ==> f.precondition((c,)) && (f.postcondition_once((c,), ()) ==> (^c).shot_store())
ensures
exists<c: &mut Committer<Self, $type, (), SeqCst>> !c.shot_store() && c.ward() == *self && c.val_store() == val && f.postcondition_once((c,), ())
Source§impl AtomicI16
impl AtomicI16
Sourcepub fn fetch_add<F>(&self, val: i16, f: Ghost<F>) -> i16
pub fn fetch_add<F>(&self, val: i16, f: Ghost<F>) -> i16
Wrapper for std::sync::atomic::AtomicI16::fetch_add.
The load and the store are always sequentially consistent.
requires
forall<c: &mut Committer<Self, $int_type, SeqCst, SeqCst>> !c.shot_store() ==> c.ward() == *self ==> c.val_store() == val + c.val_load() ==> f.precondition((c,)) && (f.postcondition_once((c,), ()) ==> (^c).shot_store())
ensures
exists<c: &mut Committer<Self, $int_type, SeqCst, SeqCst>> !c.shot_store() && c.ward() == *self && c.val_store() == val + c.val_load() && c.val_load() == result && f.postcondition_once((c,), ())
Trait Implementations§
Source§impl PermTarget for AtomicI16
impl PermTarget for AtomicI16
Source§fn is_disjoint(
&self,
_self_val: &Self::Value,
other: &Self,
_other_val: &Self::Value,
) -> bool
fn is_disjoint( &self, _self_val: &Self::Value, other: &Self, _other_val: &Self::Value, ) -> bool
Perm::disjoint_lemma. Read moreAuto Trait Implementations§
impl !Freeze for AtomicI16
impl Objective for AtomicI16
impl RefUnwindSafe for AtomicI16
impl Send for AtomicI16
impl Sync for AtomicI16
impl Unpin for AtomicI16
impl UnsafeUnpin for AtomicI16
impl UnwindSafe for AtomicI16
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<G, T> Guard<FullBorrow<T>> for Gwhere
G: GuardRef<T>,
impl<G, T> Guard<FullBorrow<T>> for Gwhere
G: GuardRef<T>,
Source§fn guards(self, initial: FullBorrow<T>, current: FullBorrow<T>) -> bool
fn guards(self, initial: FullBorrow<T>, current: FullBorrow<T>) -> bool
logic(open, prophetic, inline)
self.guards_ref(current.cur()) && ^initial == ^current
Source§impl<C> GuardRef<Perm<C>> for Cwhere
C: PermTarget + ?Sized,
impl<C> GuardRef<Perm<C>> for Cwhere
C: PermTarget + ?Sized,
Source§fn guards_ref(self, c: Perm<C>) -> bool
fn guards_ref(self, c: Perm<C>) -> bool
logic(open, inline)
*c.ward() == self