pub struct HelpTopicRegistry { /* private fields */ }Expand description
Catalogue of every registered topic, keyed by name. Plugins and
future LSP integrations register through
register.
Topics are held behind Arc so the registry is cheap to Clone,
which is what the HelpTopicRegistryHandle RCU write path needs
(clone → mutate → store). The Arc earns its place beyond clone
cost: HelpTopicBody::Compressed carries a OnceLock
decompression cache, and sharing the topic means an RCU write does
not throw away every already-inflated body.
Implementations§
Source§impl HelpTopicRegistry
impl HelpTopicRegistry
pub fn new() -> HelpTopicRegistry
Sourcepub fn into_handle(self) -> Arc<ArcSwapAny<Arc<HelpTopicRegistry>>> ⓘ
pub fn into_handle(self) -> Arc<ArcSwapAny<Arc<HelpTopicRegistry>>> ⓘ
Wrap this registry in a fresh HelpTopicRegistryHandle.
Exists so consumers — the host’s boot, the loader’s drain, their
tests — do not each have to name arc_swap just to build the
handle this crate defines.
pub fn register(&mut self, topic: HelpTopic)
Sourcepub fn unregister_plugin(&mut self, plugin_id: u64) -> usize
pub fn unregister_plugin(&mut self, plugin_id: u64) -> usize
Drop every topic contributed by plugin_id, returning how many
were removed. Idempotent: a second call reports zero, which is
what the teardown contract requires of a double-unload.
Builtins carry plugin_id: None and are therefore untouchable
through this path — no plugin’s unload can remove a core page.
pub fn lookup(&self, name: &str) -> Option<&HelpTopic>
pub fn names(&self) -> impl Iterator<Item = &str>
pub fn iter(&self) -> impl Iterator<Item = &HelpTopic>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn topics_for_command<'a>(
&'a self,
command_name: &'a str,
) -> impl Iterator<Item = &'a HelpTopic> + 'a
pub fn topics_for_command<'a>( &'a self, command_name: &'a str, ) -> impl Iterator<Item = &'a HelpTopic> + 'a
Find every topic whose related_command_patterns contains
a substring of command_name. Used by
:describe-command to emit cross-links. Stable insertion
order; multiple topics can match.
Trait Implementations§
Source§impl Clone for HelpTopicRegistry
impl Clone for HelpTopicRegistry
Source§fn clone(&self) -> HelpTopicRegistry
fn clone(&self) -> HelpTopicRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HelpTopicRegistry
impl Debug for HelpTopicRegistry
Source§impl Default for HelpTopicRegistry
impl Default for HelpTopicRegistry
Source§fn default() -> HelpTopicRegistry
fn default() -> HelpTopicRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for HelpTopicRegistry
impl !UnwindSafe for HelpTopicRegistry
impl Freeze for HelpTopicRegistry
impl Send for HelpTopicRegistry
impl Sync for HelpTopicRegistry
impl Unpin for HelpTopicRegistry
impl UnsafeUnpin for HelpTopicRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more