pub struct MatrixSelector {
pub selector: VectorSelector,
pub range: Duration,
}Expand description
A matrix selector expression (range vector).
Selects a range of samples over time for each matching time series. Extends a vector selector with a duration in square brackets.
§Example
use rusty_promql_parser::parser::selector::{MatrixSelector, VectorSelector};
use rusty_promql_parser::lexer::duration::Duration;
let sel = MatrixSelector::with_name("http_requests", Duration::from_secs(300));
assert_eq!(sel.to_string(), "http_requests[5m]");Fields§
§selector: VectorSelectorThe underlying vector selector.
range: DurationThe range duration (e.g., 5m, 1h, 30s).
Implementations§
Source§impl MatrixSelector
impl MatrixSelector
Sourcepub fn new(selector: VectorSelector, range: Duration) -> Self
pub fn new(selector: VectorSelector, range: Duration) -> Self
Create a new matrix selector from a vector selector and range
Sourcepub fn with_name(name: impl Into<String>, range: Duration) -> Self
pub fn with_name(name: impl Into<String>, range: Duration) -> Self
Create a matrix selector with just a metric name and range
Sourcepub fn matchers(&self) -> &[LabelMatcher]
pub fn matchers(&self) -> &[LabelMatcher]
Get the label matchers
Sourcepub fn range_millis(&self) -> i64
pub fn range_millis(&self) -> i64
Get the range duration in milliseconds
Sourcepub fn offset_millis(&self) -> Option<i64>
pub fn offset_millis(&self) -> Option<i64>
Get the offset duration in milliseconds (if any)
Sourcepub fn at(&self) -> Option<&AtModifier>
pub fn at(&self) -> Option<&AtModifier>
Get the @ modifier (if any)
Trait Implementations§
Source§impl Clone for MatrixSelector
impl Clone for MatrixSelector
Source§fn clone(&self) -> MatrixSelector
fn clone(&self) -> MatrixSelector
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 MatrixSelector
impl Debug for MatrixSelector
Source§impl Display for MatrixSelector
impl Display for MatrixSelector
Source§impl PartialEq for MatrixSelector
impl PartialEq for MatrixSelector
impl StructuralPartialEq for MatrixSelector
Auto Trait Implementations§
impl Freeze for MatrixSelector
impl RefUnwindSafe for MatrixSelector
impl Send for MatrixSelector
impl Sync for MatrixSelector
impl Unpin for MatrixSelector
impl UnwindSafe for MatrixSelector
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