forall 'k.
struct BufferRestore! { ... }
The way back from Buffer!::open to a growable Buffer!. Carries cap as well as len, so a restored buffer keeps growing as before.
Restricted: restore turns one of these plus a matching Exclusive!['k] into an owning Buffer!, so forging one would yield a freeable buffer over an arbitrary pointer.
The address and the brand travel inside the two linear core::mem records that Allocation!::adopt and Region!::share mint over the buffer's storage:
store: Allocation![u8,'k]-- the right to retire the block, and the only thing that remembers its base. Restricted, linear and unprojectable, so it cannot be offset.back: RegionResume![u8,'k]-- the receipt for theExclusive!['k]thatopenhanded out.resumedemands that exact witness back and returns the completeRegion![u8,'k]thatAllocation!::releaserequires.
No separate Brand['k] field: everything restore builds is brandless, so the brand is never needed as a value.
Methods
method restoresource
fn restore(self, tag: Exclusive!['k]) -> Buffer! { ... }
Rebuilds the growable Buffer! from this record and the capability open handed out.
The only way back to a growable Buffer!. Sound however the Slice from the same open was sub-sliced or used, since the address rebuilt here never came from it.
resume demands the exact Exclusive!['k] that open's share handed out and rebuilds the complete Region![u8,'k]; release demands that complete region -- proof that every access capability of this brand has come back -- and returns the Uninit! whose base Allocation!::adopt recorded. No Ref is constructed, and no address is read out of a field this module wrote. 'k is sealed fresh per open, and BufferRestore! is restricted and linear, so the only Exclusive!['k] that exists for this brand is the one passed here.