pub struct Pattern(/* private fields */);
Expand description
A Pattern
is a QualifiedPattern
reference, however, it disallows any
references under the refs/rad
hierarchy.
Implementations§
Trait Implementations§
Source§impl AsRef<QualifiedPattern<'static>> for Pattern
impl AsRef<QualifiedPattern<'static>> for Pattern
Source§fn as_ref(&self) -> &QualifiedPattern<'static>
fn as_ref(&self) -> &QualifiedPattern<'static>
Source§impl<'de> Deserialize<'de> for Pattern
impl<'de> Deserialize<'de> for Pattern
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Pattern, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Pattern, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Pattern> for QualifiedPattern<'static>
impl From<Pattern> for QualifiedPattern<'static>
Source§fn from(_: Pattern) -> QualifiedPattern<'static>
fn from(_: Pattern) -> QualifiedPattern<'static>
Source§impl Ord for Pattern
Patterns are ordered by their specificity.
impl Ord for Pattern
Patterns are ordered by their specificity.
This is heavily influenced by the evaluation priority of Rules. For a candidate reference name, we want the rule associated with the most specific pattern to apply, i.e. to take priority over all other rules with less specific patterns.
For two patterns φ
and ψ
, we say that “φ
is more specific than ψ
”, denoted
φ < ψ
if:
- The number of components in
φ
is larger than the number of components inψ
. (Note that the number of components is equal to the number of occurrences of the symbol ‘/’ in the pattern, plus 1). The justification is, that refnames might be interpreted as a hierarchy where a match on more components would mean a match at a lower level in the hierarchy, thus being more specific. Imagine a refname hierarchy that maps to a corporate hierarchy. The pattern “department-1” matches all refnames that are administered by a particular department, and thus is not very specific. To contrast, the pattern “department-1/team-a/project-i/nice-feature” is very specific as it matches all refnames that relate to the development of a particular feature for a particular project by a particular team. Note that this would also apply when the connection between theφ
andψ
is not as obvious, e.g. alsoa/b/c/d/* < */x
.
(Note that for the following items, one may assume that φ
and ψ
have the
same number of components.)
-
If path component i of
φ
, denotedφ[i]
, is more specific than path component i ofψ
, denotedψ[i]
. This is the case if: a.φ[i]
does not contain an asterisk andψ[i]
contains an asterisk, i.e. the symbol*
, e.g.a < * and abc < a*
. Note that this is important to capture specificity accross components, i.e. to conclude thata/b/* < a/*/c
. b. Bothφ[i]
andψ[i]
contain an asterisk. A. The asterisk inφ[i]
is further right than the asterisk inφ[i]
, e.g.aa* < a*
. B. The asterisk inφ[i]
andψ[i]
is equally far to the right, andφ[i]
is longer thanψ[i]
, e.g.a*b < a*
. -
Otherwise, fall back to a lexicographic ordering.
Some examples (justification in parentheses):
refs/tags/release/candidates/* <(1.) refs/tags/release/* <(1.) refs/tags/*
refs/tags/v1.0 <(2.a.) refs/tags/*
refs/heads/* <(3.) refs/tags/*
refs/heads/main <(3.) refs/tags/v1.0
Source§impl PartialOrd for Pattern
impl PartialOrd for Pattern
Source§impl Serialize for Pattern
impl Serialize for Pattern
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,
Source§impl<'a> TryFrom<QualifiedPattern<'a>> for Pattern
impl<'a> TryFrom<QualifiedPattern<'a>> for Pattern
Source§type Error = PatternError
type Error = PatternError
Source§fn try_from(
pattern: QualifiedPattern<'a>,
) -> Result<Pattern, <Pattern as TryFrom<QualifiedPattern<'a>>>::Error>
fn try_from( pattern: QualifiedPattern<'a>, ) -> Result<Pattern, <Pattern as TryFrom<QualifiedPattern<'a>>>::Error>
impl Eq for Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
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>
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