pub struct FracStorage<T> { /* private fields */ }Expand description
The authoritative fractional storage resource.
Implementations§
Source§impl<T> FracStorage<T>
impl<T> FracStorage<T>
Sourcepub closed spec fn storage_resource(self) -> StorageResource<(), T, FracP<T>>
pub closed spec fn storage_resource(self) -> StorageResource<(), T, FracP<T>>
Sourcepub closed spec fn protocol_monoid(self) -> FracP<T>
pub closed spec fn protocol_monoid(self) -> FracP<T>
Sourcepub open spec fn has_full_frac(self) -> bool
pub open spec fn has_full_frac(self) -> bool
{ self.frac() == 1.0real }Sourcepub proof fn new(tracked v: T) -> tracked res : Self
pub proof fn new(tracked v: T) -> tracked res : Self
ensures
res.has_full_frac(),Allocate a new fractional storage resource with full permission.
Sourcepub proof fn split(tracked &mut self) -> tracked r : FracStorage<T>
pub proof fn split(tracked &mut self) -> tracked r : FracStorage<T>
ensures
self.id() == old(self).id(),self.resource() == old(self).resource(),r.resource() == old(self).resource(),r.id() == old(self).id(),r.frac() + self.frac() == old(self).frac(),Split one token into two tokens whose quantities sum to the original.
Auto Trait Implementations§
impl<T> Freeze for FracStorage<T>
impl<T> RefUnwindSafe for FracStorage<T>where
T: RefUnwindSafe,
impl<T> Send for FracStorage<T>
impl<T> Sync for FracStorage<T>
impl<T> Unpin for FracStorage<T>where
T: Unpin,
impl<T> UnwindSafe for FracStorage<T>where
T: UnwindSafe,
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