Module std::retire
Retiring elements of a Buf into a caller's reclamation budget (Budget{Free}): the
functions install a retire_from block over the budget, and its reclaimer destroys what they
retire when the budget's owner destroys it. A budget with too few slots aborts the process.
Source: std/retire.weir; committed interface: std/retire.iface. Index
- fn
retire_last: Pops the last element ofvand retires it intob;falsewhenvis empty. Aborts the process ifbhas no free slot. - fn
retire_all: Pops every element ofv, last first, and retires each intob, leavingvempty. Aborts the process at the first elementbhas no slot for.
fn retire_last
pub fn retire_last<T: portable>(v: &mut Buf<T>, b: &mut Budget{Free}) -> Bool
Pops the last element of v and retires it into b; false when v is empty.
Aborts the process if b has no free slot.
Committed interface (std/retire.iface):
writes through v: {len} and its shape
writes through b: everything
destroys values of T
fn retire_all
pub fn retire_all<T: portable>(v: &mut Buf<T>, b: &mut Budget{Free})
Pops every element of v, last first, and retires each into b, leaving v empty.
Aborts the process at the first element b has no slot for.
Committed interface (std/retire.iface):
writes through v: {len} and its shape
writes through b: everything
destroys values of T