This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cell::RefCell; | |
// `generational_arena` is a special type of arena that allows elements to be recycled, and the | |
// handles allocated from the arena do not hold a borrow on the arena. The handles are later used to | |
// retrieve concrete borrows on the arena temporarily. The check for live-ness is essentially | |
// performed at runtime, rather than being checked by the borrow checker. | |
use generational_arena::{Arena, Index}; | |
// Allocate `ARENA` at global/thread scope. The arena is wrapped in a RefCell so we can get | |
// runtime-checked mutable borrows of the arena. |