pub struct HelpTopicIndex { /* private fields */ }Expand description
An owned view of an installed package’s Meta/Rd.rds topic metadata.
This source is separate from help/aliases.rds. Rows and alias groups are
preserved, and Self::find_alias selects the first matching row.
crate::PackageHelpDb::resolve_alias instead uses the last occurrence
in aliases.rds. Neither lookup consults or overrides the other source.
Implementations§
Source§impl HelpTopicIndex
impl HelpTopicIndex
Sourcepub fn read_installed(
package_dir: impl AsRef<Path>,
) -> Result<Option<Self>, Error>
pub fn read_installed( package_dir: impl AsRef<Path>, ) -> Result<Option<Self>, Error>
Reads Meta/Rd.rds below an explicitly named installed-package directory.
Returns Ok(None) only for a missing path, Ok(Some(index)) for
present metadata (including a valid empty index), and an error for
other I/O failures, decoding failures, or an invalid required schema.
No help .rdx, .rdb, or aliases.rds file is opened.
Sourcepub fn read_installed_with_options(
package_dir: impl AsRef<Path>,
options: &ReadOptions,
) -> Result<Option<Self>, Error>
pub fn read_installed_with_options( package_dir: impl AsRef<Path>, options: &ReadOptions, ) -> Result<Option<Self>, Error>
Reads installed metadata with explicit file, decompression, and decoder
bounds and encoding policy supplied to rd_rds::file.
Sourcepub fn from_object(root: &RObject) -> Result<Self, Error>
pub fn from_object(root: &RObject) -> Result<Self, Error>
Validates and copies a decoded topic metadata data frame.
The root must be a named list with class data.frame, unique non-NA
column names, and row.names agreeing with the required Aliases
list column. Each alias cell must be a character vector; NA aliases
are retained but never match a lookup. Invalid alias strings are
errors. Additional columns are ignored.
Name, Title, and File are optional character columns. Missing columns
and NA values are retained explicitly. Wrong column types, excess
values, missing row values in short columns, and undecodable strings
become HelpTopicText::Invalid, preserving usable neighboring
fields and rows. RDS decoding errors remain fatal before this view
can recover individual fields.
Sourcepub fn entries(&self) -> impl ExactSizeIterator<Item = &HelpTopicEntry>
pub fn entries(&self) -> impl ExactSizeIterator<Item = &HelpTopicEntry>
Iterates over entries in stored row order.
Sourcepub fn find_alias(&self, alias: &str) -> Option<&HelpTopicEntry>
pub fn find_alias(&self, alias: &str) -> Option<&HelpTopicEntry>
Finds the first row containing this alias, ignoring NA alias values. Lookup is case-sensitive and does not normalize text. A first match with unavailable optional fields still wins over later matches.