Skip to main content

with

Function with 

Source
pub fn with<R, FnR>(sym: SymStr, caller: FnR) -> R
where FnR: FnOnce(&str) -> R,
Expand description

Resolve a symbol and call the closure with a &str reference. The closure may intern (pin(), pin_char(), …): the text is lent under a shared borrow of the arena, so a string new during the lend goes to the overflow page instead of growing (and moving) the buffer the text lives in (string-interner 0.20 buffer.rs:144). An overflow symbol’s lend holds the borrow too, so every lend is one where a reset panics.