pub struct ResourcePatternFilter { /* private fields */ }Expand description
Represents a filter that can match ResourcePattern.
Implementations§
Source§impl ResourcePatternFilter
impl ResourcePatternFilter
Sourcepub fn new(
resource_type: ResourceType,
name: Option<String>,
pattern_type: PatternType,
) -> ResourcePatternFilter
pub fn new( resource_type: ResourceType, name: Option<String>, pattern_type: PatternType, ) -> ResourcePatternFilter
Create a filter using the supplied parameters.
§Arguments
resource_type- resource type. IfResourceType::Any, the filter will ignore the resource type of the pattern. If any other resource type, the filter will match only patterns with the same type.name- resource name orNone. IfNone, the filter will ignore the name of resources. IfResourcePattern::WILDCARD_RESOURCE, will match only wildcard patterns.pattern_type- resource pattern type. IfPatternType::Any, the filter will match patterns regardless of pattern type. IfPatternType::Match, the filter will match patterns that would match the suppliedname, including matching prefixed and wildcard patterns. If any other resource pattern type, the filter will match only patterns with the same type.
Sourcepub fn any() -> ResourcePatternFilter
pub fn any() -> ResourcePatternFilter
Matches any resource pattern.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this filter has any UNKNOWN components.
Sourcepub fn resource_type(&self) -> ResourceType
pub fn resource_type(&self) -> ResourceType
Returns the specific resource type this pattern matches.
Sourcepub fn pattern_type(&self) -> PatternType
pub fn pattern_type(&self) -> PatternType
Returns the resource pattern type.
Sourcepub fn matches(&self, pattern: &ResourcePattern) -> bool
pub fn matches(&self, pattern: &ResourcePattern) -> bool
§Arguments
pattern- the pattern to match
§Returns
true if this filter matches the given pattern.
§Panics
Panics with Unsupported PatternType: UNKNOWN if this filter’s pattern
type is PatternType::Match, it has a name, and pattern’s pattern
type is PatternType::Unknown, where Java throws
IllegalArgumentException; a ResourcePattern cannot hold the other
two filter-only types, Any and Match. A pattern with a pattern type a
newer broker added reports Unknown, so check
ResourcePattern::pattern_type before matching it against a Match
filter.
Sourcepub fn matches_at_most_one(&self) -> bool
pub fn matches_at_most_one(&self) -> bool
Returns true if this filter could only match one pattern. In other
words, if there are no ANY or UNKNOWN fields.
Sourcepub fn find_indefinite_field(&self) -> Option<String>
pub fn find_indefinite_field(&self) -> Option<String>
Returns a string describing any ANY or UNKNOWN field, or None if there is
no such field.
Trait Implementations§
Source§impl Clone for ResourcePatternFilter
impl Clone for ResourcePatternFilter
Source§fn clone(&self) -> ResourcePatternFilter
fn clone(&self) -> ResourcePatternFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourcePatternFilter
impl Debug for ResourcePatternFilter
Source§impl Display for ResourcePatternFilter
impl Display for ResourcePatternFilter
Source§impl Hash for ResourcePatternFilter
impl Hash for ResourcePatternFilter
Source§impl PartialEq for ResourcePatternFilter
impl PartialEq for ResourcePatternFilter
impl Eq for ResourcePatternFilter
impl StructuralPartialEq for ResourcePatternFilter
Auto Trait Implementations§
impl Freeze for ResourcePatternFilter
impl RefUnwindSafe for ResourcePatternFilter
impl Send for ResourcePatternFilter
impl Sync for ResourcePatternFilter
impl Unpin for ResourcePatternFilter
impl UnsafeUnpin for ResourcePatternFilter
impl UnwindSafe for ResourcePatternFilter
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.