The Standard Library as Architecture
Helix’s standard-library types expose its ownership model.
Vec<Box<dyn Component>>is an ordered, heterogeneous UI layer stack.HashMap<ViewId, Selection>lets one document own per-view cursor state.Option<T>marks modes and resources that genuinely may not exist.Box<dyn FnOnce(...) + Send>is a one-use command carrying captured owned data.Arc<ArcSwap<Config>>gives readers cheap configuration snapshots while a reload replaces the shared value.std::mem::taketemporarily moves accumulated changes or futures out of a borrowed owner so they can be processed safely.- process handles, atomics, and
Durationmake external lifecycle and deadlines explicit.
The crucial distinction is between value snapshots and mutation rights. A rope
clone is cheap structural sharing suitable for an async operation. An &mut Editor is deliberately scarce and never held across a detached task.
This is a recurring Rust design pattern: clone stable input, move it into work, then return a small result or command to the unique owner.