Skip to main content

register

Function register 

Source
pub fn register(name: impl Into<String>, adapter: Weak<dyn ModelDebug>)
Expand description

Register a model under a human-readable name. The name does not need to be unique across registrations — the inspector lists every entry — but uniqueness aids tracking.

Stores a Weak to the adapter so the registry never keeps models alive. The caller is responsible for retaining a strong Rc to the adapter (typically by stashing it inside the model’s own Rc<RefCell<Inner>>, see ListModel::debug_named).

Prunes dead entries first — snapshot also prunes, but a session that churns many short-lived models (e.g. lazily realized rows) without ever calling snapshot would otherwise grow the registry unbounded.