pub struct Config {
pub include: Vec<String>,
pub exclude: Vec<String>,
pub interface: Option<InterfaceConfig>,
pub parsers: HashMap<String, ParserConfig>,
pub rules: HashMap<String, RuleConfig>,
pub config_dir: Option<PathBuf>,
}Fields§
§include: Vec<String>Glob patterns declaring which filesystem paths become File nodes.
Default: ["*.md"].
exclude: Vec<String>Glob patterns removed from the graph (applied after include).
Also respects .gitignore.
interface: Option<InterfaceConfig>§parsers: HashMap<String, ParserConfig>§rules: HashMap<String, RuleConfig>§config_dir: Option<PathBuf>Directory containing the drft.toml this config was loaded from.
Implementations§
Source§impl Config
impl Config
pub fn defaults() -> Self
pub fn load(root: &Path) -> Result<Self>
pub fn rule_severity(&self, name: &str) -> RuleSeverity
Sourcepub fn is_rule_in_scope(&self, rule: &str, path: &str) -> bool
pub fn is_rule_in_scope(&self, rule: &str, path: &str) -> bool
Check if a path is in scope for a specific rule (passes files filter).
Sourcepub fn is_rule_ignored(&self, rule: &str, path: &str) -> bool
pub fn is_rule_ignored(&self, rule: &str, path: &str) -> bool
Check if a path should be ignored for a specific rule.
Sourcepub fn rule_options(&self, name: &str) -> Option<&Value>
pub fn rule_options(&self, name: &str) -> Option<&Value>
Get a rule’s options (the [rules.<name>.options] section).
Sourcepub fn custom_rules(&self) -> impl Iterator<Item = (&str, &RuleConfig)>
pub fn custom_rules(&self) -> impl Iterator<Item = (&str, &RuleConfig)>
Get custom rules (rules with a command field).
Trait Implementations§
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more