Skip to main content

Wiki

Struct Wiki 

Source
pub struct Wiki { /* private fields */ }
Expand description

Unified wiki structure with lazy-loaded content caching.

Implementations§

Source§

impl Wiki

Source

pub fn build(root: WikiRoot, config: WikiConfig) -> Result<Self, WikiError>

Build wiki from root — discovers paths only, no file reads.

Source

pub fn root(&self) -> &WikiRoot

Source

pub fn config(&self) -> &WikiConfig

Source

pub fn pages(&self) -> &HashMap<PageId, PageEntry>

Source

pub fn get(&self, id: &PageId) -> Option<&PageEntry>

Source

pub fn contains(&self, id: &PageId) -> bool

Source

pub fn find(&self, name: &str) -> Option<(&PageId, &PageEntry)>

Find a page by name. Always O(1) since PageIds are normalized to lowercase.

Source

pub fn display_name(&self, id: &PageId) -> Option<&str>

Get the display name for a page (original filename case from rel_path).

Source

pub fn index_path(&self) -> Option<PathBuf>

Source

pub fn entry_path(&self, entry: &PageEntry) -> PathBuf

Get the absolute path for a page entry.

Source

pub fn rel_path<'a>(&self, path: &'a Path) -> &'a Path

Convert an absolute path to a path relative to the wiki root.

Source

pub fn all_scannable_files(&self) -> Vec<PathBuf>

All wiki page files that should be scanned for wikilink content.

Autolink pages — lazily computed on first access.

Source

pub fn abs_path(&self, path: &Path) -> PathBuf

Source

pub fn file(&self, path: &Path) -> Result<&CachedFile, WikiError>

Get cached file, loading on first access.

Source

pub fn source(&self, path: &Path) -> Result<&str, WikiError>

Get source content for a file.

Source

pub fn frontmatter( &self, path: &Path, ) -> Result<&Result<Option<Frontmatter>, FrontmatterError>, WikiError>

Get frontmatter for a file.

Source

pub fn headings(&self, path: &Path) -> Result<&[Heading], WikiError>

Get headings for a file.

Get wikilinks for a file.

Source

pub fn classified_ranges( &self, path: &Path, ) -> Result<&[ClassifiedRange], WikiError>

Get classified ranges for a file.

Source

pub fn block_ids(&self, path: &Path) -> Result<&[BlockId], WikiError>

Get block IDs for a file.

Source

pub fn write_file( &mut self, path: &Path, content: &str, ) -> Result<(), WikiError>

Write file content. Takes &mut self to ensure no outstanding borrows.

Source

pub fn rename_file(&mut self, old: &Path, new: &Path) -> Result<(), WikiError>

Rename a file. Takes &mut self to ensure no outstanding borrows.

Auto Trait Implementations§

§

impl !Freeze for Wiki

§

impl !RefUnwindSafe for Wiki

§

impl Send for Wiki

§

impl !Sync for Wiki

§

impl Unpin for Wiki

§

impl UnsafeUnpin for Wiki

§

impl !UnwindSafe for Wiki

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.