pub struct ModelineRegistry { /* private fields */ }Expand description
Descriptor registry. Host-owned storage; modes register in
on_activate and remove when their Guard drops (there is no
on_deactivate); plugins via WIT, ML.6.
Holds only descriptors — the churning content lives in the host
content store, not here, so registration is rare and cheap.
Implementations§
Source§impl ModelineRegistry
impl ModelineRegistry
Sourcepub fn register(&mut self, element: ModelineElement)
pub fn register(&mut self, element: ModelineElement)
Register (or replace) a descriptor. Last-write-wins on a duplicate id — well-defined, matching the action-handler registry’s semantics.
Sourcepub fn remove(&mut self, id: &ElementId) -> Option<ModelineElement>
pub fn remove(&mut self, id: &ElementId) -> Option<ModelineElement>
Remove a descriptor (idempotent). Returns the removed element.
Sourcepub fn get(&self, id: &ElementId) -> Option<&ModelineElement>
pub fn get(&self, id: &ElementId) -> Option<&ModelineElement>
The descriptor registered under id, if any.
Sourcepub fn ids(&self) -> impl Iterator<Item = &ElementId>
pub fn ids(&self) -> impl Iterator<Item = &ElementId>
Every registered id, in no particular order.
Added for OC.3’s teardown, which reverses a plugin’s elements by namespace rather than by a recorded token list: a plugin may register a segment at any point in its life, so a token list collected at load would miss a later one and leave its descriptor rendering forever with nobody to update it. Reversing by prefix has nothing to forget — the same reasoning the compilation parser factories are torn down by provenance.
Sourcepub fn zone_ordered(&self, zone: Zone) -> Vec<&ModelineElement>
pub fn zone_ordered(&self, zone: Zone) -> Vec<&ModelineElement>
Descriptors in zone, in left-to-right visual order: ascending
by priority for every zone (ties broken by ElementId for
determinism). The renderer right-aligns the whole Right zone
block (lualine/helix model), so the highest-priority Right
element still lands at the far right without inverting the sort —
priority means the same thing (leftward → rightward) in all
three zones.
Trait Implementations§
Source§impl Clone for ModelineRegistry
impl Clone for ModelineRegistry
Source§fn clone(&self) -> ModelineRegistry
fn clone(&self) -> ModelineRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more