pub struct LabelMatcher {
pub name: String,
pub op: LabelMatchOp,
pub value: String,
}Expand description
A single label matcher.
Label matchers filter time series based on their label values.
§Example
use rusty_promql_parser::parser::selector::{LabelMatcher, LabelMatchOp};
let matcher = LabelMatcher::new("job", LabelMatchOp::Equal, "prometheus");
assert_eq!(matcher.to_string(), r#"job="prometheus""#);Fields§
§name: StringLabel name (e.g., “job”, “name”).
op: LabelMatchOpMatching operator.
value: StringValue to match against.
Implementations§
Source§impl LabelMatcher
impl LabelMatcher
Sourcepub fn new(
name: impl Into<String>,
op: LabelMatchOp,
value: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, op: LabelMatchOp, value: impl Into<String>, ) -> Self
Create a new label matcher
Sourcepub fn matches_empty(&self) -> bool
pub fn matches_empty(&self) -> bool
Check if this matcher matches the empty string
Trait Implementations§
Source§impl Clone for LabelMatcher
impl Clone for LabelMatcher
Source§fn clone(&self) -> LabelMatcher
fn clone(&self) -> LabelMatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LabelMatcher
impl Debug for LabelMatcher
Source§impl Display for LabelMatcher
impl Display for LabelMatcher
Source§impl PartialEq for LabelMatcher
impl PartialEq for LabelMatcher
impl Eq for LabelMatcher
impl StructuralPartialEq for LabelMatcher
Auto Trait Implementations§
impl Freeze for LabelMatcher
impl RefUnwindSafe for LabelMatcher
impl Send for LabelMatcher
impl Sync for LabelMatcher
impl Unpin for LabelMatcher
impl UnwindSafe for LabelMatcher
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