Skip to main content

HelpTopicIndex

Struct HelpTopicIndex 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn entries(&self) -> impl ExactSizeIterator<Item = &HelpTopicEntry>

Iterates over entries in stored row order.

Source

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.

Source

pub fn len(&self) -> usize

Returns the number of stored rows, including rows with no aliases.

Source

pub fn is_empty(&self) -> bool

Returns whether the metadata contains no rows.

Trait Implementations§

Source§

impl Clone for HelpTopicIndex

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HelpTopicIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for HelpTopicIndex

Source§

impl PartialEq for HelpTopicIndex

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HelpTopicIndex

Source§

impl TryFrom<&RObject> for HelpTopicIndex

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &RObject) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.