Struct vstd::rwlock::RwLockToks::Instance
source · pub struct Instance<K, V, Pred: InvariantPredicate<K, V>> { /* private fields */ }
Implementations§
source§impl<K, V, Pred: InvariantPredicate<K, V>> Instance<K, V, Pred>
impl<K, V, Pred: InvariantPredicate<K, V>> Instance<K, V, Pred>
pub fn clone(&self) -> Self
pub fn k(&self) -> K
pub fn pred(&self) -> PhantomData<Pred>
sourcepub proof fn initialize_full(
k: K,
t: V,
tracked param_token_storage: Option<V>
) -> tracked tmp_tuple : (Tracked<Instance<K, V, Pred>>, Tracked<flag_exc<K, V, Pred>>, Tracked<flag_rc<K, V, Pred>>, Tracked<Option<pending_writer<K, V, Pred>>>, Tracked<Option<writer<K, V, Pred>>>, Tracked<Map<(), pending_reader<K, V, Pred>>>, Tracked<Map<V, reader<K, V, Pred>>>)
pub proof fn initialize_full( k: K, t: V, tracked param_token_storage: Option<V> ) -> tracked tmp_tuple : (Tracked<Instance<K, V, Pred>>, Tracked<flag_exc<K, V, Pred>>, Tracked<flag_rc<K, V, Pred>>, Tracked<Option<pending_writer<K, V, Pred>>>, Tracked<Option<writer<K, V, Pred>>>, Tracked<Map<(), pending_reader<K, V, Pred>>>, Tracked<Map<V, reader<K, V, Pred>>>)
requires
(Pred::inv(k, t)),
(crate::prelude::equal(param_token_storage, Option::Some(t))),
ensures({
let (
instance,
param_token_flag_exc,
param_token_flag_rc,
param_token_pending_writer,
param_token_writer,
param_token_pending_reader,
param_token_reader,
) = tmp_tuple;
let instance = instance.view();
let param_token_flag_exc = param_token_flag_exc.view();
let param_token_flag_rc = param_token_flag_rc.view();
let param_token_pending_writer = param_token_pending_writer.view();
let param_token_writer = param_token_writer.view();
let param_token_pending_reader = param_token_pending_reader.view();
let param_token_reader = param_token_reader.view();
(crate::prelude::equal(param_token_flag_exc.view().instance, instance))
&& (crate::prelude::equal(param_token_flag_rc.view().instance, instance))
&& (crate::prelude::equal(instance.k(), k))
&& (crate::prelude::equal(instance.pred(), PhantomData))
&& (crate::prelude::equal(param_token_flag_exc.view().value, false))
&& (crate::prelude::equal(param_token_flag_rc.view().value, 0))
&& (pending_writer::<
K,
V,
Pred,
>::option_agree_strict(param_token_pending_writer, Option::None, instance))
&& (writer::<
K,
V,
Pred,
>::option_agree_strict(param_token_writer, Option::None, instance))
&& (pending_reader::<
K,
V,
Pred,
>::multiset_agree_strict(
param_token_pending_reader,
Multiset::empty(),
instance,
))
&& (reader::<
K,
V,
Pred,
>::multiset_agree_strict(param_token_reader, Multiset::empty(), instance))
}),
sourcepub proof fn acquire_read_start(tracked
&self,
tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>
) -> tracked param_token_0_pending_reader : pending_reader<K, V, Pred>
pub proof fn acquire_read_start(tracked &self, tracked param_token_flag_rc: &mut flag_rc<K, V, Pred> ) -> tracked param_token_0_pending_reader : pending_reader<K, V, Pred>
requires
(crate::prelude::equal(
crate::prelude::old(param_token_flag_rc).view().instance,
(*self),
)),
ensures(crate::prelude::equal(param_token_flag_rc.view().instance, (*self))),
(crate::prelude::equal(param_token_0_pending_reader.view().instance, (*self))),
(((crate::prelude::equal(param_token_0_pending_reader.view().key, ()))
&& (param_token_0_pending_reader.view().count == 1))),
(crate::prelude::equal(
param_token_flag_rc.view().value,
crate::prelude::old(param_token_flag_rc).view().value + 1,
)),
sourcepub proof fn acquire_read_end(tracked
&self,
tracked param_token_flag_exc: &flag_exc<K, V, Pred>,
tracked param_token_0_pending_reader: pending_reader<K, V, Pred>
) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<reader<K, V, Pred>>)
pub proof fn acquire_read_end(tracked &self, tracked param_token_flag_exc: &flag_exc<K, V, Pred>, tracked param_token_0_pending_reader: pending_reader<K, V, Pred> ) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<reader<K, V, Pred>>)
requires
(crate::prelude::equal(param_token_flag_exc.view().instance, (*self))),
(crate::prelude::equal(param_token_0_pending_reader.view().instance, (*self))),
((param_token_flag_exc.view().value == false)),
(((crate::prelude::equal(param_token_0_pending_reader.view().key, ()))
&& (param_token_0_pending_reader.view().count == 1))),
ensures({
let (original_field_storage, param_token_1_reader) = tmp_tuple;
let original_field_storage = original_field_storage.view();
let param_token_1_reader = param_token_1_reader.view();
(crate::prelude::equal(param_token_1_reader.view().instance, (*self)))
&& ({
let x: V = original_field_storage.get_Some_0();
((crate::prelude::equal(param_token_1_reader.view().key, x))
&& (param_token_1_reader.view().count == 1))
})
&& ({
let x: V = original_field_storage.get_Some_0();
Pred::inv((*self).k(), x)
})
}),
sourcepub proof fn acquire_read_abandon(tracked
&self,
tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>,
tracked param_token_0_pending_reader: pending_reader<K, V, Pred>
)
pub proof fn acquire_read_abandon(tracked &self, tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>, tracked param_token_0_pending_reader: pending_reader<K, V, Pred> )
requires
(crate::prelude::equal(
crate::prelude::old(param_token_flag_rc).view().instance,
(*self),
)),
(crate::prelude::equal(param_token_0_pending_reader.view().instance, (*self))),
(((crate::prelude::equal(param_token_0_pending_reader.view().key, ()))
&& (param_token_0_pending_reader.view().count == 1))),
ensures(crate::prelude::equal(param_token_flag_rc.view().instance, (*self))),
((crate::prelude::old(param_token_flag_rc).view().value >= 1)),
(crate::prelude::equal(
param_token_flag_rc.view().value,
(crate::prelude::old(param_token_flag_rc).view().value - 1) as nat,
)),
sourcepub proof fn acquire_exc_start(tracked
&self,
tracked param_token_flag_exc: &mut flag_exc<K, V, Pred>
) -> tracked param_token_0_pending_writer : pending_writer<K, V, Pred>
pub proof fn acquire_exc_start(tracked &self, tracked param_token_flag_exc: &mut flag_exc<K, V, Pred> ) -> tracked param_token_0_pending_writer : pending_writer<K, V, Pred>
requires
(crate::prelude::equal(
crate::prelude::old(param_token_flag_exc).view().instance,
(*self),
)),
((crate::prelude::old(param_token_flag_exc).view().value == false)),
ensures(crate::prelude::equal(param_token_flag_exc.view().instance, (*self))),
(crate::prelude::equal(param_token_0_pending_writer.view().instance, (*self))),
(crate::prelude::equal(param_token_0_pending_writer.view().value, ())),
(crate::prelude::equal(param_token_flag_exc.view().value, true)),
sourcepub proof fn acquire_exc_end(tracked
&self,
tracked param_token_flag_rc: &flag_rc<K, V, Pred>,
tracked param_token_0_pending_writer: pending_writer<K, V, Pred>
) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<V>, Tracked<writer<K, V, Pred>>)
pub proof fn acquire_exc_end(tracked &self, tracked param_token_flag_rc: &flag_rc<K, V, Pred>, tracked param_token_0_pending_writer: pending_writer<K, V, Pred> ) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<V>, Tracked<writer<K, V, Pred>>)
requires
(crate::prelude::equal(param_token_flag_rc.view().instance, (*self))),
(crate::prelude::equal(param_token_0_pending_writer.view().instance, (*self))),
((param_token_flag_rc.view().value == 0)),
(crate::prelude::equal(param_token_0_pending_writer.view().value, ())),
ensures({
let (original_field_storage, param_token_2_storage, param_token_1_writer) = tmp_tuple;
let original_field_storage = original_field_storage.view();
let param_token_2_storage = param_token_2_storage.view();
let param_token_1_writer = param_token_1_writer.view();
(crate::prelude::equal(param_token_1_writer.view().instance, (*self)))
&& (crate::prelude::equal(param_token_1_writer.view().value, ()))
&& ({
let x = original_field_storage.get_Some_0();
crate::prelude::equal(param_token_2_storage, x)
})
&& ({
let x = original_field_storage.get_Some_0();
Pred::inv((*self).k(), x)
})
}),
sourcepub proof fn release_exc(tracked
&self,
x: V,
tracked param_token_flag_exc: &mut flag_exc<K, V, Pred>,
tracked param_token_1_storage: V,
tracked param_token_0_writer: writer<K, V, Pred>
)
pub proof fn release_exc(tracked &self, x: V, tracked param_token_flag_exc: &mut flag_exc<K, V, Pred>, tracked param_token_1_storage: V, tracked param_token_0_writer: writer<K, V, Pred> )
requires
(crate::prelude::equal(
crate::prelude::old(param_token_flag_exc).view().instance,
(*self),
)),
(crate::prelude::equal(param_token_0_writer.view().instance, (*self))),
(Pred::inv((*self).k(), x)),
(crate::prelude::equal(param_token_0_writer.view().value, ())),
(crate::prelude::equal(param_token_1_storage, x)),
ensures(crate::prelude::equal(param_token_flag_exc.view().instance, (*self))),
(crate::prelude::equal(param_token_flag_exc.view().value, false)),
sourcepub proof fn read_guard<'a>(tracked
&self,
x: V,
tracked param_token_0_reader: &'a reader<K, V, Pred>
) -> tracked param_token_1_storage : &'a V
pub proof fn read_guard<'a>(tracked &self, x: V, tracked param_token_0_reader: &'a reader<K, V, Pred> ) -> tracked param_token_1_storage : &'a V
requires
(crate::prelude::equal(param_token_0_reader.view().instance, (*self))),
(((crate::prelude::equal(param_token_0_reader.view().key, x))
&& (param_token_0_reader.view().count == 1))),
ensures(crate::prelude::equal(*param_token_1_storage, x)),
sourcepub proof fn read_match(tracked
&self,
x: V,
y: V,
tracked param_token_0_reader: &reader<K, V, Pred>,
tracked param_token_1_reader: &reader<K, V, Pred>
)
pub proof fn read_match(tracked &self, x: V, y: V, tracked param_token_0_reader: &reader<K, V, Pred>, tracked param_token_1_reader: &reader<K, V, Pred> )
requires
(crate::prelude::equal(param_token_0_reader.view().instance, (*self))),
(crate::prelude::equal(param_token_1_reader.view().instance, (*self))),
(((crate::prelude::equal(param_token_0_reader.view().key, x))
&& (param_token_0_reader.view().count == 1))),
(((crate::prelude::equal(param_token_1_reader.view().key, y))
&& (param_token_1_reader.view().count == 1))),
ensures((equal(x, y))),
requires
(crate::prelude::equal(
crate::prelude::old(param_token_flag_rc).view().instance,
(*self),
)),
(crate::prelude::equal(param_token_0_reader.view().instance, (*self))),
(((crate::prelude::equal(param_token_0_reader.view().key, x))
&& (param_token_0_reader.view().count == 1))),
ensures(crate::prelude::equal(param_token_flag_rc.view().instance, (*self))),
((crate::prelude::old(param_token_flag_rc).view().value >= 1)),
(crate::prelude::equal(
param_token_flag_rc.view().value,
(crate::prelude::old(param_token_flag_rc).view().value - 1) as nat,
)),
Auto Trait Implementations§
impl<K, V, Pred> RefUnwindSafe for Instance<K, V, Pred>
impl<K, V, Pred> Send for Instance<K, V, Pred>
impl<K, V, Pred> Sync for Instance<K, V, Pred>
impl<K, V, Pred> Unpin for Instance<K, V, Pred>
impl<K, V, Pred> UnwindSafe for Instance<K, V, Pred>
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
Mutably borrows from an owned value. Read more