#[non_exhaustive]pub enum ModuleRule {
MustNotImport {
module: String,
},
RestrictImportsTo {
allowed: Vec<String>,
},
MustNotBeImportedBy {
importer: String,
},
MustOnlyBeImportedBy {
allowed: Vec<String>,
},
ConfineExternalCrate {
crate_name: String,
},
ConfineInlineSymbolPath {
prefix: String,
ending_with: Option<Vec<String>>,
strict: bool,
},
}Expand description
What a module boundary forbids.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MustNotImport
The governed module must not import this module (or anything beneath it).
RestrictImportsTo
The governed module may import only these modules (each “or beneath”), plus its own subtree; any other internal import is a violation. An empty allowlist permits only the module’s own subtree.
MustNotBeImportedBy
The governed (protected) module must not be imported by this module (or anything
beneath it) — an inbound encapsulation rule, the mirror of MustNotImport. A
module within the protected module’s own subtree is never an importer.
MustOnlyBeImportedBy
The governed (protected) module may be imported only by these importers (each “or
beneath”) or by its own subtree; any other module that imports it (or anything beneath
it) is a violation — the inbound dual of RestrictImportsTo. An empty allowlist permits
only the protected module’s own subtree.
ConfineExternalCrate
An external crate may be imported only within the governed module’s own subtree
(the permitted subtree, or beneath it); any use <crate_name>::… from a module
outside that subtree is a violation. The first module rule that observes external
imports — every other rule ignores them. The confined crate is the violation target,
so identity stays injective across different confined crates on the same subtree.
ConfineInlineSymbolPath
Within the governed module’s subtree, forbid inline symbol-path calls resolving under
a declared module-path prefix — the inline-symbol-path (layer b) sibling of
ConfineExternalCrate, observing calls rather than
use imports. The “core reads no ambient clock; time is injected” pattern. The confined
prefix is the violation target, so identity stays injective across nested prefixes on the
same subtree.
Fields
Trait Implementations§
Source§impl Clone for ModuleRule
impl Clone for ModuleRule
Source§fn clone(&self) -> ModuleRule
fn clone(&self) -> ModuleRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more