pub struct TimeFilter {
pub issue: Option<u32>,
pub assignee: Option<String>,
pub date_from: Option<String>,
pub date_to: Option<String>,
pub include_deleted: bool,
}Expand description
The normalized, read-only issue/assignee/period selector (data-model §3).
Every field is optional and every named one is required to match — the AND rule
above. Self::include_deleted is the one field that selects nothing: it is the
explicit audit context, and it only ever widens what is reported about the
entries the other criteria already selected, never what is summed (T017).
The assignee criterion names the identity that did the work — the entry’s
author — because that is the one identity a time entry carries (data-model §1).
The issue’s own assignee is ownership, and this read-only module does not filter
on it, so a time operation can never appear to change who owns the issue (C-008).
Fields§
§issue: Option<u32>The stable issue number to select, or None for every issue.
assignee: Option<String>The identity that did the work, or None for every identity.
date_from: Option<String>The inclusive lower calendar bound, YYYY-MM-DD.
date_to: Option<String>The inclusive upper calendar bound, YYYY-MM-DD.
include_deleted: boolWhether to report the deleted entries History retains (audit context).
Implementations§
Source§impl TimeFilter
impl TimeFilter
Sourcepub fn for_assignee(self, assignee: impl Into<String>) -> Self
pub fn for_assignee(self, assignee: impl Into<String>) -> Self
Select the entries one identity did.
Sourcepub fn between(self, start: impl Into<String>, end: impl Into<String>) -> Self
pub fn between(self, start: impl Into<String>, end: impl Into<String>) -> Self
Bound the period on both sides, inclusively.
Sourcepub fn including_deleted(self) -> Self
pub fn including_deleted(self) -> Self
Report the deleted entries History retains, too (audit context, T017).
Sourcepub const fn is_unfiltered(&self) -> bool
pub const fn is_unfiltered(&self) -> bool
Whether the filter names no criterion at all.
Sourcepub const fn has_period(&self) -> bool
pub const fn has_period(&self) -> bool
Whether the filter names a calendar period.
Sourcepub fn problems(&self) -> Vec<TimeFilterError>
pub fn problems(&self) -> Vec<TimeFilterError>
Every reason the filter cannot be used as written, in field order; empty means valid.
The bounds are checked with the crate’s calendar validator and the assignee with the crate’s identity parser, so “valid” here means the same thing it means everywhere else. An inverted period is only reported when both bounds are themselves valid: reporting both a bad bound and an inversion derived from it would name one mistake twice.
Sourcepub fn validate(&self) -> Result<(), Vec<TimeFilterError>>
pub fn validate(&self) -> Result<(), Vec<TimeFilterError>>
Refuse the filter unless every criterion is usable.
Sourcepub fn canonical_assignee(&self) -> Option<String>
pub fn canonical_assignee(&self) -> Option<String>
The assignee criterion in canonical identity form, resolved once.
What Self::selects compares against, and what an aggregation should
resolve once instead of re-parsing per entry (T014).
Sourcepub fn place(&self, date: Option<&str>) -> PeriodPlacement
pub fn place(&self, date: Option<&str>) -> PeriodPlacement
Where date falls relative to this filter’s period (T013).
A filter that names no bounds places every date in the period, including an entry with no date and an entry whose date is unreadable: with no period there is nothing to fail to place, and the entry’s own problems are reported by the aggregation that reads its fields.
The bounds are assumed readable — Self::problems is checked before any
aggregation, and Self::selects refuses an invalid filter outright. A
malformed bound is never read here, so it can never be mistaken for “no
bound” by a caller that validated its filter.
Sourcepub fn selects(&self, issue: u32, entry: &TimeEntry) -> bool
pub fn selects(&self, issue: u32, entry: &TimeEntry) -> bool
Whether one entry of one issue is selected by the whole predicate.
The AND rule, in one place: the issue criterion, then the assignee criterion,
then the period placement. An invalid criterion selects nothing rather
than being skipped: an unreadable bound must not behave as no bound and a
blank identity must not match every author, because both would read a mistake
as a wider scope than the caller asked for. Self::problems is where the
reason is reported. For a pass over many entries resolve
Self::canonical_assignee once instead: this convenience canonicalizes the
criterion per call.
Trait Implementations§
Source§impl Clone for TimeFilter
impl Clone for TimeFilter
Source§impl Debug for TimeFilter
impl Debug for TimeFilter
Source§impl Default for TimeFilter
impl Default for TimeFilter
Source§impl Display for TimeFilter
impl Display for TimeFilter
impl Eq for TimeFilter
Source§impl PartialEq for TimeFilter
impl PartialEq for TimeFilter
impl StructuralPartialEq for TimeFilter
Auto Trait Implementations§
impl Freeze for TimeFilter
impl RefUnwindSafe for TimeFilter
impl Send for TimeFilter
impl Sync for TimeFilter
impl Unpin for TimeFilter
impl UnsafeUnpin for TimeFilter
impl UnwindSafe for TimeFilter
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more