pub struct LintGroup {
pub config: LintGroupConfig,
/* private fields */
}
Fields§
§config: LintGroupConfig
Implementations§
Source§impl LintGroup
impl LintGroup
pub fn empty() -> Self
Sourcepub fn contains_key(&self, name: impl AsRef<str>) -> bool
pub fn contains_key(&self, name: impl AsRef<str>) -> bool
Check if the group already contains a linter with a given name.
Sourcepub fn add(&mut self, name: impl AsRef<str>, linter: Box<dyn Linter>) -> bool
pub fn add(&mut self, name: impl AsRef<str>, linter: Box<dyn Linter>) -> bool
Add a Linter
to the group, returning whether the operation was successful.
If it returns false
, it is because a linter with that key already existed in the group.
Sourcepub fn add_pattern_linter(
&mut self,
name: impl AsRef<str>,
linter: Box<dyn PatternLinter>,
) -> bool
pub fn add_pattern_linter( &mut self, name: impl AsRef<str>, linter: Box<dyn PatternLinter>, ) -> bool
Add a PatternLinter
to the group, returning whether the operation was successful.
If it returns false
, it is because a linter with that key already existed in the group.
This function is not significantly different from Self::add
, but allows us to take
advantage of some properties of PatternLinter
s for cache optimization.
Sourcepub fn merge_from(&mut self, other: &mut LintGroup)
pub fn merge_from(&mut self, other: &mut LintGroup)
Merge the contents of another LintGroup
into this one.
The other lint group will be left empty after this operation.
pub fn iter_keys(&self) -> impl Iterator<Item = &str>
Sourcepub fn set_all_rules_to(&mut self, enabled: Option<bool>)
pub fn set_all_rules_to(&mut self, enabled: Option<bool>)
Set all contained rules to a specific value.
Passing None
will unset that rule, allowing it to assume its default state.
pub fn all_descriptions(&self) -> HashMap<&str, &str>
Sourcepub fn with_lint_config(self, config: LintGroupConfig) -> Self
pub fn with_lint_config(self, config: LintGroupConfig) -> Self
Swap out Self::config
with another LintGroupConfig
.
pub fn new_curated( dictionary: Arc<impl Dictionary + 'static>, dialect: Dialect, ) -> Self
Sourcepub fn new_curated_empty_config(
dictionary: Arc<impl Dictionary + 'static>,
dialect: Dialect,
) -> Self
pub fn new_curated_empty_config( dictionary: Arc<impl Dictionary + 'static>, dialect: Dialect, ) -> Self
Create a new curated group with all config values cleared out.
Trait Implementations§
Source§impl Linter for LintGroup
impl Linter for LintGroup
Source§fn lint(&mut self, document: &Document) -> Vec<Lint>
fn lint(&mut self, document: &Document) -> Vec<Lint>
Lint
s.
We pass self
mutably for caching purposes.Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for LintGroup
impl !RefUnwindSafe for LintGroup
impl !Send for LintGroup
impl !Sync for LintGroup
impl Unpin for LintGroup
impl !UnwindSafe for LintGroup
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> 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