pub struct Rules { /* private fields */ }Expand description
A validated set of per-path strategies, shaped as a trie.
Exact paths only: two rules can meet at one node at most once, so “most specific wins” never has to arbitrate. The trie shape is what makes adding globs later a change to lookup rather than to the data.
Implementations§
Source§impl Rules
impl Rules
Sourcepub fn build(
rules: impl IntoIterator<Item = (Vec<String>, Strategy)>,
) -> Result<Self, RuleErrors>
pub fn build( rules: impl IntoIterator<Item = (Vec<String>, Strategy)>, ) -> Result<Self, RuleErrors>
Validates a whole rule set at once and builds the trie.
Validating the finished set rather than each insertion is what makes
order-independence structural rather than a property to be maintained:
unreachability can be created from either direction (db then
db.plugins, or the reverse) and both are caught without an insert-time
symmetry argument.
A duplicate path with the same strategy is accepted — scripts accumulate flags. Only differing strategies conflict.
Trait Implementations§
impl Eq for Rules
impl StructuralPartialEq for Rules
Auto Trait Implementations§
impl Freeze for Rules
impl RefUnwindSafe for Rules
impl Send for Rules
impl Sync for Rules
impl Unpin for Rules
impl UnsafeUnpin for Rules
impl UnwindSafe for Rules
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.