pub struct Config {
pub allow_unrecognised: bool,
pub allow_invalid: bool,
pub subfolders_are_namespaces: bool,
/* private fields */
}Expand description
Configuration for requirements management.
This struct holds settings that control how requirements are managed, including HRID formatting, directory structure modes, and validation rules.
Fields§
§allow_unrecognised: boolWhether to allow the requirements directory to contain markdown files with names that are not valid HRIDs
allow_invalid: boolWhether to allow markdown files with names that are valid HRIDs that are not correctly formatted
subfolders_are_namespaces: boolWhether subfolder paths contribute to the namespace of requirements.
When false (default): The full HRID is encoded in the filename.
Example: system/auth/REQ-001.md -> HRID is parsed as REQ-001
Example: custom/system-auth-REQ-001.md -> HRID is
system-auth-REQ-001
When true: Subfolders encode the namespace, filename contains KIND-ID.
Example: system/auth/REQ-001.md -> HRID is system-auth-REQ-001
Example: system/auth/USR/001.md -> HRID is system-auth-USR-001
(The format is inferred: numeric filename means KIND in parent folder)
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path) -> Result<Self, String>
pub fn load(path: &Path) -> Result<Self, String>
Loads the configuration from a TOML file at the given path.
§Errors
Returns an error if the file cannot be read or if the TOML content is invalid.
Sourcepub fn save(&self, path: &Path) -> Result<(), String>
pub fn save(&self, path: &Path) -> Result<(), String>
Saves the configuration to a TOML file at the given path.
§Errors
Returns an error if the configuration cannot be serialized to TOML or if the file cannot be written.
Sourcepub fn allowed_kinds(&self) -> &[String]
pub fn allowed_kinds(&self) -> &[String]
Returns the allowed kinds, if configured.
Sourcepub const fn set_subfolders_are_namespaces(&mut self, value: bool)
pub const fn set_subfolders_are_namespaces(&mut self, value: bool)
Sets the subfolders_are_namespaces configuration option.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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>,
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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