Skip to main content

Bundle

Struct Bundle 

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

A loaded OKF bundle.

Implementations§

Source§

impl Bundle

Source

pub fn load(root: impl AsRef<Path>) -> Result<Bundle, BundleError>

Loads a bundle from a directory tree.

Returns an error only for I/O failures or a non-directory root. Per-file parse failures are recorded in Bundle::parse_errors.

Source

pub fn root(&self) -> &Path

The bundle’s root directory.

Source

pub fn concepts(&self) -> &[Concept]

All successfully parsed concepts, in path order.

Source

pub fn len(&self) -> usize

Number of concepts.

Source

pub fn is_empty(&self) -> bool

true if the bundle has no concepts.

Source

pub fn get(&self, id: &ConceptId) -> Option<&Concept>

Looks up a concept by id.

Source

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

true if a concept with this id exists.

Source

pub fn index_files(&self) -> &[PathBuf]

Paths of all index.md files found (§6).

Source

pub fn log_files(&self) -> &[PathBuf]

Paths of all log.md files found (§7).

Source

pub fn parse_errors(&self) -> &[(PathBuf, DocumentError)]

Files whose frontmatter could not be parsed during loading.

The resolved outbound cross-links from a concept.

The ids of concepts that link to the given concept (“cited by” / § backlinks).

All broken internal links in the bundle, as (source, raw_target) pairs. Broken links are permitted by the spec (§5.3) — this is informational.

Source

pub fn okf_version(&self) -> Option<String>

The declared OKF version from the bundle-root index.md frontmatter, if present (okf_version, §11). This is the only place frontmatter is permitted in an index.md.

Trait Implementations§

Source§

impl Debug for Bundle

Source§

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

Formats the value using the given formatter. Read more

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.