Skip to main content

luaur_ast/methods/
allocator_allocator_allocator_alt_b.rs

1use crate::records::allocator::Allocator;
2
3#[allow(non_snake_case)]
4impl Allocator {
5    /// C++ move constructor `Allocator::Allocator(Allocator&& rhs)`
6    /// (Ast/src/Allocator.cpp:15): steals `rhs`'s pages and leaves `rhs` in the
7    /// null/empty state (still usable — `allocate` lazily allocates a fresh page
8    /// when `root` is null). Returns the newly-constructed owning allocator.
9    pub fn allocator_allocator(rhs: &mut Allocator) -> Allocator {
10        let moved = Allocator {
11            root: rhs.root,
12            offset: rhs.offset,
13        };
14
15        rhs.root = core::ptr::null_mut();
16        rhs.offset = 0;
17
18        moved
19    }
20}