pub struct Regime { /* private fields */ }Expand description
The Regime: owns decree instances and enforces them over sources.
Implementations§
Source§impl Regime
impl Regime
pub fn new() -> Self
pub fn with_decree(self, decree: BoxDecree) -> Self
pub fn add_decree(&mut self, decree: BoxDecree)
Sourcepub fn set_rule_ignores_from_config(&mut self, config: Option<&DictateConfig>)
pub fn set_rule_ignores_from_config(&mut self, config: Option<&DictateConfig>)
Configure per-rule ignores from a loaded .dictate.toml.
Ignores are keyed by decree name (decree.<name>) and rule name (the
portion after {decree}/ in diagnostic rule identifiers).
Sourcepub fn watched_extensions(&self) -> Option<HashSet<String>>
pub fn watched_extensions(&self) -> Option<HashSet<String>>
Return the union of supported extensions for all loaded decrees.
- If at least one decree declares specific extensions, returns
Some(HashSet)of those (lowercased) extensions. - If no decree declares extensions (all empty lists), returns
None, meaning “watch everything” (typical when only supreme is loaded).
Sourcepub fn add_wasm_decree<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn add_wasm_decree<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Load a WASM decree from a file path.
§Errors
Returns an error if the file cannot be loaded, if it’s not a valid WASM/native decree, or if the decree’s ABI version is incompatible with the host.
Sourcepub fn enforce(&self, sources: &[Source<'_>]) -> Result<Diagnostics>
pub fn enforce(&self, sources: &[Source<'_>]) -> Result<Diagnostics>
Enforce all decrees over provided sources.
Matching priority:
skip_filenames- decree owns file but returns empty diagnosticssupported_filenames- exact filename matchsupported_extensions- extension match- Universal decrees (empty lists) run on all files unless shadowed
§Errors
Returns an error if any decree fails during linting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Regime
impl !RefUnwindSafe for Regime
impl Send for Regime
impl Sync for Regime
impl Unpin for Regime
impl !UnwindSafe for Regime
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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>
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