Skip to main content

DocTree

Struct DocTree 

Source
pub struct DocTree {
    pub docs: Vec<Document>,
    pub errors: Vec<ScanError>,
    pub root: PathBuf,
}
Expand description

A scanned documentation tree containing parsed documents and any scan errors.

Fields§

§docs: Vec<Document>§errors: Vec<ScanError>§root: PathBuf

Implementations§

Source§

impl DocTree

Source

pub fn scan(root: &Path) -> Self

Scan a directory for all markdown files and parse them.

Source

pub fn scan_filtered(root: &Path, filter: &ScanFilter) -> Self

Scan with a filter applied.

Source

pub fn all(&self) -> &[Document]

Get all documents.

Source

pub fn by_category(&self, category: Category) -> Vec<&Document>

Get documents by category.

Source

pub fn by_tag(&self, tag: &str) -> Vec<&Document>

Get documents matching a tag.

Source

pub fn search(&self, query: &str) -> Vec<&Document>

Search documents by title or body content (case-insensitive substring match).

Source

pub fn get(&self, rel_path: &str) -> Option<&Document>

Get a document by its path (relative to root).

Source

pub fn counts(&self) -> HashMap<Category, usize>

Count documents by category.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.