pub struct ProjectConfig {
pub base: String,
pub pad: usize,
pub layout: Layout,
pub types: BTreeMap<String, DocType>,
pub rules: Vec<Rule>,
pub stats: Vec<StatSpec>,
pub palette: BTreeMap<String, PaletteEntry>,
pub tui: TuiConfig,
pub file_refs: FileRefs,
}Fields§
§base: StringInventory base directory, relative to the project root (the dir holding
opys.toml). Defaults to opys.
pad: usize§layout: Layout§types: BTreeMap<String, DocType>§rules: Vec<Rule>§stats: Vec<StatSpec>Custom stats sections rendered by opys stats (and the TUI stats
screen). Each is a single sql query over the corpus view, rendered as
a markdown table.
palette: BTreeMap<String, PaletteEntry>Presentation rules for the TUI. Ignored by the core engine; parsed and
validated here so config validate catches mistakes regardless of the
tui feature. See crate::palette.
tui: TuiConfigTUI list presentation. Ignored by the core engine; see TuiConfig.
file_refs: FileRefsHow document ids are mentioned in code, for show --refs and the
post-renumber reference warning. See FileRefs.
Implementations§
Source§impl ProjectConfig
impl ProjectConfig
Sourcepub fn load(path: &Path) -> Result<ProjectConfig>
pub fn load(path: &Path) -> Result<ProjectConfig>
Load opys.toml, or a usage error pointing at config init when absent.
Sourcepub fn doc_dirs(&self) -> Vec<&str>
pub fn doc_dirs(&self) -> Vec<&str>
The distinct directories (under the base) that hold documents — the set generic discovery scans. Multiple types may share a dir (assigned by id prefix at load).
Sourcepub fn dir_for_id(&self, id: &str) -> &str
pub fn dir_for_id(&self, id: &str) -> &str
The directory holding the type whose prefix matches id (the default dir
when the prefix matches no type).
Sourcepub fn doc_relpath(&self, id: &str, status: &str) -> PathBuf
pub fn doc_relpath(&self, id: &str, status: &str) -> PathBuf
The canonical file path for a document, relative to the inventory base:
the layout.path template with {type}/{status}/{id} substituted and
empty path segments collapsed. The {type}/{status} segments come from
the type matching id’s prefix (empty for an unknown prefix).
Sourcepub fn type_name_for_id(&self, id: &str) -> Option<&str>
pub fn type_name_for_id(&self, id: &str) -> Option<&str>
The name of the type whose prefix matches id’s prefix, if any. (A doc’s
type is derived from its ID prefix — the ID is the single source of truth.)
Trait Implementations§
Source§impl Clone for ProjectConfig
impl Clone for ProjectConfig
Source§fn clone(&self) -> ProjectConfig
fn clone(&self) -> ProjectConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProjectConfig
impl Debug for ProjectConfig
Source§impl<'de> Deserialize<'de> for ProjectConfig
impl<'de> Deserialize<'de> for ProjectConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ProjectConfig
impl RefUnwindSafe for ProjectConfig
impl Send for ProjectConfig
impl Sync for ProjectConfig
impl Unpin for ProjectConfig
impl UnsafeUnpin for ProjectConfig
impl UnwindSafe for ProjectConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more