pub struct Config {
pub repo_root: PathBuf,
pub spec_home: PathBuf,
pub raw: RawConfig,
pub registry: Registry,
pub implicit: bool,
pub tracked: Option<Arc<TrackedSet>>,
}Fields§
§repo_root: PathBufF1: the repository the configuration was found from: the spec home, or under roots.toml the public repository mapped to it. Code paths typed there are named from it.
spec_home: PathBufThe spec home: the directory holding spec.toml, its owners and documents. Every repository-relative path in the configuration and the corpus is relative to it.
raw: RawConfig§registry: Registry§implicit: boolTrue when no spec.toml was found and defaults are in use.
tracked: Option<Arc<TrackedSet>>When set, walks from the spec home read only these files, plus the local directory and
anything outside the repository (spec check sets it for a full run).
Implementations§
Source§impl Config
impl Config
Sourcepub fn discover(start: &Path) -> Result<Self>
pub fn discover(start: &Path) -> Result<Self>
Finds spec.toml in start or its ancestors. Without one, the nearest git root (or start)
is used with defaults, so the tool works in any directory.
pub fn load(path: &Path) -> Result<Self>
pub fn from_raw(root: PathBuf, raw: RawConfig, implicit: bool) -> Self
Sourcepub fn tracked_only(self) -> Self
pub fn tracked_only(self) -> Self
The same configuration with walks kept to the files git tracks; unchanged outside git.
Sourcepub fn reads(&self, rel: &str, dir: bool) -> bool
pub fn reads(&self, rel: &str, dir: bool) -> bool
Whether a walk from the spec home reads the repository path rel (a file, or a folder
when dir): everything without tracked, else tracked files and the local directory.
pub fn spec_dir(&self) -> &str
Sourcepub fn type_dirs(&self) -> Vec<(String, String)>
pub fn type_dirs(&self) -> Vec<(String, String)>
(directory, type) for each type kept in a directory of its own ([types.<name>] dir),
the directory relative to an owner’s root.
Sourcepub fn path_cite_re(&self) -> Regex
pub fn path_cite_re(&self) -> Regex
The regex that finds plain-text paths to documents: into the spec directory, or to a document file in a type’s own directory.
Sourcepub fn cite_key(&self) -> String
pub fn cite_key(&self) -> String
What a scan’s path citations depend on, so a cache of scans is dropped when it changes.
pub fn manifests(&self) -> Vec<String>
pub fn root_owner(&self) -> &str
pub fn local_dir(&self) -> &str
pub fn expand_path(&self, p: &str) -> PathBuf
Trait Implementations§
Auto Trait Implementations§
impl Forget for Config
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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