pub struct PredCell<T: ?Sized>(/* private fields */);Expand description
Cell over predicates
A wrapper around std::cell::Cell that allows predicates to be used to specify the contents of the cell.
Implementations§
Source§impl<T> PredCell<T>
impl<T> PredCell<T>
Sourcepub fn swap(&self, other: &PredCell<T>)
pub fn swap(&self, other: &PredCell<T>)
See the method Cell::swap documentation.
requires
forall<x: T> self@[x] == other@[x]Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
See the method Cell::into_inner documentation.
ensures
self@[result]Source§impl<T: Copy> PredCell<T>
impl<T: Copy> PredCell<T>
Sourcepub fn update(&self, f: impl FnOnce(T) -> T)
pub fn update(&self, f: impl FnOnce(T) -> T)
See the method Cell::update documentation.
requires
forall<x: T> self@[x] ==> f.precondition((x,))requires
forall<x: T, res: T> self@[x] && f.postcondition_once((x,), res) ==> self@[res]
ensures
exists<x: T, res: T> self@[x] && f.postcondition_once((x,), res)Source§impl<T: Default> PredCell<T>
impl<T: Default> PredCell<T>
Sourcepub fn take(&self) -> T
pub fn take(&self) -> T
See the method Cell::take documentation.
requires
forall<x: T> T::default.postcondition((), x) ==> self@[x]ensures
self@[result]Source§impl<T> PredCell<[T]>
impl<T> PredCell<[T]>
Sourcepub const fn as_slice_of_cells(
&self,
_pred: Snapshot<Seq<Mapping<T, bool>>>,
) -> &[PredCell<T>]
pub const fn as_slice_of_cells( &self, _pred: Snapshot<Seq<Mapping<T, bool>>>, ) -> &[PredCell<T>]
See the method Cell::as_slice_of_cells documentation.
requires
forall<s: [T]> self@[s] == (_pred.len() == s@.len() && forall<i: Int> 0 <= i && i < s@.len() ==> _pred[i][s[i]])
ensures
forall<i: Int> 0 <= i && i < _pred.len() ==> result[i]@ == _pred[i]ensures
result@.len() == _pred.len()Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for PredCell<T>
impl<T> !RefUnwindSafe for PredCell<T>
impl<T> Send for PredCell<T>
impl<T> !Sync for PredCell<T>
impl<T> Unpin for PredCell<T>
impl<T> UnwindSafe for PredCell<T>where
T: UnwindSafe + ?Sized,
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