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

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