Transfers ownership of an affine value. The old binding cannot be read until reassigned.
SYSTEMS EXPLAINED
How Groot & Ube work
Follow a frame from window events to GPU presentation, then explore how Ube compiles code and keeps memory lifetimes predictable.
01 · GROOT ENGINE
One frame, from input to pixels
Game logic and engine packages run in the Ube guest. The native Rust host owns platform access, GPU work, and presentation.
Events: The native host pumps window events and updates keyboard, mouse, and timing state.
while game.is_running {
game.begin_frame() // refresh frame and input state
update_game_state() // Ube simulation and ECS
arena { // frame scratch lifetime
build_render_data()
game.present() // submit and present
}
}02 · UBE COMPILER
Source becomes a WebAssembly component
Ube checks types and ownership before emitting WebAssembly. With the wasi2 target, component interfaces define the host capabilities the guest can use.
The compiler performs these stages at build time. At runtime, Wasmtime instantiates the component and connects its declared imports to the Groot host.
03 · MEMORY & OWNERSHIP
Memory follows the lifetime of the data
Choose values for short-lived calculations, arenas for scoped temporary allocations, and pools for objects that persist across frames.
Stack values
Numbers, booleans, fixed arrays, and plain value structs live in locals and are copied as values.
let mut scratch = []f32{}
arena {
scratch.push(1.0) // temporary region allocation
} // region is reclaimed together
let original = "owned value"
let next = move original // ownership transfers
fn inspect(view values: []f32) {
// read-only; the view cannot escape
}Passes read-only access for the call. A view cannot be returned or stored beyond its allowed scope.
Groups temporary allocations under one lifetime, with bulk reclamation when the scope ends.
04 · DRAW DATA
Instancing packs per-object data together
Groot’s 3D instance path sends one model transform and one RGBA tint for each instance.
per instance