Skip to main content

register

Function register 

pub fn register(code: &str, kind: AnyIndex, replace: bool) -> Result<(), String>
Expand description

Registers a custom index under code for the remainder of the process, resolvable by lookup wherever a built-in is. Returns an error if code already names a built-in index, or a previously registered custom index, unless replace is set. Registrations are process-scoped and never persisted.

§Errors

A message naming code when it already names a built-in index, or an already-registered custom one, and replace is not set. Shadowing is possible but never accidental.

§Panics

If the overlay’s lock is poisoned — that is, if another thread panicked while holding it.