pub struct Window {
pub raw: String,
pub seconds: u64,
pub display: String,
}Expand description
A normalized evaluation window.
last_5m normalizes to { raw: "last_5m", seconds: 300, display: "last 5 minutes" }. Used for sorting, comparison, and human display.
Fields§
§raw: StringThe verbatim window token.
seconds: u64The window length in seconds.
display: StringA human-readable rendering, e.g. last 5 minutes.
Implementations§
Source§impl Window
impl Window
Sourcepub fn parse(raw: &str) -> Option<Self>
pub fn parse(raw: &str) -> Option<Self>
Parse and normalize a window token such as last_5m or 5m.
Recognized prefixes are last_ (the default) and current_ (the
in-progress period, e.g. current_1d). Recognized units are s, m,
h, d, w, and mo (month, normalized to 30 days). Returns None
if the token is not a recognized <prefix><number><unit> form.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Window
impl<'de> Deserialize<'de> for Window
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Window
impl StructuralPartialEq for Window
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnsafeUnpin for Window
impl UnwindSafe for Window
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