pub struct RcuLeaseAccumulator<T> { /* private fields */ }Expand description
Owner-side fractional accumulator for one delayed-reclamation resource.
Implementations§
Source§impl<T> RcuLeaseAccumulator<T>
impl<T> RcuLeaseAccumulator<T>
Sourcepub proof fn new(tracked resource: T) -> tracked res : Self
pub proof fn new(tracked resource: T) -> tracked res : Self
ensures
res.resource() == resource,res.fraction() == 1real,Stores resource and creates a whole read accumulator.
Sourcepub closed spec fn id(self) -> Loc
pub closed spec fn id(self) -> Loc
Storage-protocol identity shared by this accumulator and all of its leases.
Sourcepub closed spec fn resource(self) -> T
pub closed spec fn resource(self) -> T
The resource retained in storage while read leases exist.
Sourcepub closed spec fn fraction(self) -> real
pub closed spec fn fraction(self) -> real
Rational fraction currently accumulated by the owner.
Sourcepub proof fn split_lease(tracked &mut self) -> tracked lease : RcuReadLease<T>
pub proof fn split_lease(tracked &mut self) -> tracked lease : RcuReadLease<T>
ensures
final(self).id() == old(self).id(),final(self).resource() == old(self).resource(),lease.id() == old(self).id(),lease.resource() == old(self).resource(),final(self).fraction() == old(self).fraction() / 2real,lease.fraction() == old(self).fraction() / 2real,Splits a fresh lease without imposing a fixed reader capacity.
Sourcepub proof fn return_lease(tracked &mut self, tracked lease: RcuReadLease<T>)
pub proof fn return_lease(tracked &mut self, tracked lease: RcuReadLease<T>)
requires
old(self).id() == lease.id(),ensuresfinal(self).id() == old(self).id(),final(self).resource() == old(self).resource(),final(self).resource() == lease.resource(),final(self).fraction() == old(self).fraction() + lease.fraction(),Returns one lease to its originating accumulator.
Sourcepub proof fn reclaim(tracked self) -> tracked resource : T
pub proof fn reclaim(tracked self) -> tracked resource : T
requires
self.fraction() == 1real,ensuresresource == self.resource(),Recovers the stored resource after every lease has returned.
Sourcepub proof fn lemma_fraction_bounded(tracked &self)
pub proof fn lemma_fraction_bounded(tracked &self)
ensures
0real < self.fraction() <= 1real,Establishes the valid range of the accumulated rational fraction.
Auto Trait Implementations§
impl<T> Freeze for RcuLeaseAccumulator<T>
impl<T> RefUnwindSafe for RcuLeaseAccumulator<T>where
T: RefUnwindSafe,
impl<T> Send for RcuLeaseAccumulator<T>
impl<T> Sync for RcuLeaseAccumulator<T>
impl<T> Unpin for RcuLeaseAccumulator<T>where
T: Unpin,
impl<T> UnsafeUnpin for RcuLeaseAccumulator<T>
impl<T> UnwindSafe for RcuLeaseAccumulator<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