pub struct Rules { /* private fields */ }
Expand description
A set of valid Rule
s, where the set of DIDs and threshold are fully
resolved and valid. Since the rules are constructed via a BTreeMap
, they
cannot be duplicated.
To construct the set of rules, use Rules::from_raw
, which validates a
set of RawRule
s, and their Pattern
references, into a set of
ValidRule
s.
Implementations§
Source§impl Rules
impl Rules
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&Pattern, &Rule<ResolvedDelegates, Threshold>)>
pub fn iter( &self, ) -> impl Iterator<Item = (&Pattern, &Rule<ResolvedDelegates, Threshold>)>
Sourcepub fn from_raw<R>(
rules: impl IntoIterator<Item = (Pattern, Rule<Allowed, usize>)>,
resolve: &mut R,
) -> Result<Rules, ValidationError>
pub fn from_raw<R>( rules: impl IntoIterator<Item = (Pattern, Rule<Allowed, usize>)>, resolve: &mut R, ) -> Result<Rules, ValidationError>
Construct a set of Rules
given a set of RawRule
s.
Sourcepub fn matches<'a>(
&self,
refname: &Qualified<'a>,
) -> impl Iterator<Item = (&Pattern, &Rule<ResolvedDelegates, Threshold>)> + use<'a, '_>
pub fn matches<'a>( &self, refname: &Qualified<'a>, ) -> impl Iterator<Item = (&Pattern, &Rule<ResolvedDelegates, Threshold>)> + use<'a, '_>
Return the matching rules for the given refname
.
Sourcepub fn canonical<'a, 'b>(
&'a self,
refname: Qualified<'b>,
repo: &Repository,
) -> Result<Option<Canonical<'b, 'a>>, CanonicalError>
pub fn canonical<'a, 'b>( &'a self, refname: Qualified<'b>, repo: &Repository, ) -> Result<Option<Canonical<'b, 'a>>, CanonicalError>
Match given refname, take the most specific rule, and prepare evaluation
as Canonical
N.b. it will find the first rule that is most specific for the given
refname
.
Trait Implementations§
Source§impl Extend<(Pattern, Rule<ResolvedDelegates, Threshold>)> for Rules
impl Extend<(Pattern, Rule<ResolvedDelegates, Threshold>)> for Rules
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<(Pattern, Rule<ResolvedDelegates, Threshold>)> for Rules
impl FromIterator<(Pattern, Rule<ResolvedDelegates, Threshold>)> for Rules
Source§impl<'a> IntoIterator for &'a Rules
impl<'a> IntoIterator for &'a Rules
Source§impl IntoIterator for Rules
impl IntoIterator for Rules
Source§impl Serialize for Rules
impl Serialize for Rules
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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 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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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