pub struct Config { /* private fields */ }
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_config_file<P: AsRef<Path>>(config_file: P) -> Result<Self>
pub fn from_config_file<P: AsRef<Path>>(config_file: P) -> Result<Self>
Read the rule configuration from a TOML file.
The configuration file is a TOML file that contains a table of rule settings. Each rule has a unique name, and each rule can have a set of settings that are specific to that rule.
The setting named level
is reserved for setting the rule’s severity level.
Rules can be turned off by setting the rule to false
.
The configuration file can also include other files using the include()
function. This allows for modular configuration, where each rule can be
defined in a separate file, and then included into the main configuration
file.
Example:
[Rule001SomeRule]
level = "error"
option1 = true
option2 = "value"
Rule002SomeOtherRule = "include('some_other_rule.toml')"
Rule003NotApplied = false
pub fn from_serializable<T: Serialize>( config: T, config_dir: &ConfigDir, ) -> Result<Self>
pub fn is_ignored(&self, path: &Path) -> bool
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 !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
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>
Converts
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>
Converts
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