Skip to main content

charged_to

Function charged_to 

Source
pub fn charged_to<R>(
    account: &mut Account,
    wire: Option<&AtomicBool>,
    f: impl FnOnce() -> R,
) -> R
Expand description

Run f with every allocation and free this thread makes charged to account instead of the account running now, which is set aside and put back unchanged when f returns or unwinds.

The moment held passes bound the account is exhausted, and wire (an interpreter’s interrupt flag, Interpreter::set_interrupt) is set, so the tree-walker’s next step halts. That is the only refusal the allocator makes: it never fails an allocation, since a failed allocation aborts the process. With Counting not installed nothing is charged and nothing is refused.