Struct

std::mem::Restore!

source

Re-exported from core::mem::Restore!.

forall T, 'r.
struct Restore! { ... }

The receipt Region!::split keeps back: the base pointer and the parent's own Exclusive!['r], held while the parts are out. Like RegionResume! it leads back to a Region![T,'r], but it is a different type, for the reason Allocation!/Region! are two types: share's receipt and split's receipt account for two different events, and merging them would let one value stand in for both. Restricted, and merge is the ONLY producer of a Region![T,'r] from one, as RegionResume!::resume is for its receipt.

merge rebuilds the Region![T,'r] from self's OWN stored pointer, NEVER from a part: parts are permutable (nothing pins field 0's part to field 0's storage once opened), so a merge that derived the parent's base address from a part would read the wrong offset back the moment a caller reordered the product. Restore! makes the correct base address available without touching a part at all.

Methods

method mergesource

fn merge(self, parts: foreach *F of * T => exists 'f. (Region![F, 'f], Link!['f, 'r])) -> Region![T, 'r] { ... }

The parent region again, from every part Region!::split made.

Region!::split's exact inverse. Consumes the WHOLE product -- every part, in whatever order the caller hands them back -- and self, the receipt split kept. Four properties carry the soundness:

  1. Link! names both brands (see the struct).
  2. Restore! is one-shot: it is consumed by value here, so a second merge on the same receipt is unspellable.
  3. No public operation consumes a single Link! in isolation: the only way to discharge one is inside this foreach, which maps the whole product together with self, or not at all (a map consumes each component of its operand exactly once, and a product holding linear parts cannot be dropped).
  4. The returned Region![T,'r] is rebuilt from self's own pointer and capability, never from a part, since parts are permutable (see Restore!).

Each part is destructured only to CONSUME it: the child's capability is retired and its link discarded. Nothing about the child's pointer or brand flows into the rebuilt parent; that pointer addresses one field, not the whole block. What the map makes, foreach *F of *T => (), is Copy, as its body mentions no F.