pub struct RefSelector { /* private fields */ }Expand description
A list of positive and negative RefPatterns.
An entry is a pattern with an optional first !, which makes it negative.
A name is selected when the list has no positive pattern or a positive
pattern matches it, and no negative pattern matches it. The order of the
entries has no effect, and an empty list selects each name.
Implementations§
Source§impl RefSelector
impl RefSelector
Sourcepub fn parse<'a>(
entries: impl IntoIterator<Item = &'a str>,
) -> Result<RefSelector>
pub fn parse<'a>( entries: impl IntoIterator<Item = &'a str>, ) -> Result<RefSelector>
Parses a list of entries. An entry is a pattern with an optional first
!. The selector keeps the entries in their order, with repeats.
§Errors
Error::InvalidRefPatternif an entry is not valid. The text names the entry with its!.
Sourcepub fn new(positive: Vec<RefPattern>, negative: Vec<RefPattern>) -> RefSelector
pub fn new(positive: Vec<RefPattern>, negative: Vec<RefPattern>) -> RefSelector
Makes a selector of the positive patterns positive and the negative
patterns negative.
The call cannot fail. The selector keeps the patterns in their order,
with repeats. It is the selector that parse
gives for the same entries.
Sourcepub fn matches(&self, name: &str) -> bool
pub fn matches(&self, name: &str) -> bool
Returns true if the selector selects name.
The name is not checked against the ref-name rule.
Sourcepub fn positive(&self) -> &[RefPattern]
pub fn positive(&self) -> &[RefPattern]
Returns the positive patterns in entry order.
Sourcepub fn negative(&self) -> &[RefPattern]
pub fn negative(&self) -> &[RefPattern]
Returns the negative patterns in entry order, with the ! removed.