pub enum FilterField {
Assignee,
Label,
Status,
Priority,
Cycle,
Milestone,
Reviewer,
StartDate,
DueDate,
Parent,
Category,
}Expand description
A selectable structured-filter criterion.
FilterField::ALL is the single ordered field list the filter modal
renders its rows from (risk: field/modal drift) and StructuredFilter
evaluates over — adding a criterion (FR-011) is one more Option<String>
field on StructuredFilter plus one variant / match arm here.
Variants§
Assignee
Label
Status
Priority
Cycle
Milestone
Reviewer
StartDate
DueDate
Parent
An issue’s direct parent, by selector (WP06 T024).
Category
An issue’s resolved workflow category, by category key (WP08 T034).
Derived, not stored. Unlike the nine above, this criterion matches
nothing an issue’s file contains: there is no category frontmatter key
(research R2), and the value comes from the issue’s status resolved
through the board’s category_map. See FilterField::key for what
that means for diagnostics.
Implementations§
Source§impl FilterField
impl FilterField
Sourcepub const ALL: [FilterField; 11]
pub const ALL: [FilterField; 11]
The criteria in modal row order (research D-05).
Parent is appended rather than interleaved: a row’s position is a
user’s muscle memory and a TUI test’s golden index, and moving eight
existing rows to make room for a ninth helps nobody (T024 step 2).
Category is appended after Parent, for the same reason T024 step 2
gave: a row’s position is a user’s muscle memory and the TUI’s golden
index, and it is also the position a user reaches last. A category is the
one criterion a user cannot reach from the file itself, so it is the one
they will look up last.
pub fn label(self) -> &'static str
Sourcepub fn key(self) -> &'static str
pub fn key(self) -> &'static str
The serialized frontmatter key each criterion matches against
(Issue::to_file_contents emits these). Used by diagnostics.
For FilterField::Category this is the token name, not a frontmatter
key, because there is no category key: the criterion is derived from the
issue’s status through the board’s category_map (research R2). T034
step 4 asked what to report here and warned that leaving a nonexistent key
in the diagnostics would be a quiet lie, so the honest spelling is
category — which is exactly what the user types, and what the grammar
parses — plus FilterField::is_derived for any surface that has to
explain the criterion rather than merely echo it.
The distinction is not cosmetic. key() feeds two things that read very
differently: a hint bar, where category:completed is exactly right, and
an error, where “no issue has category:completed” would send a user
looking for a field that does not exist. [is_derived] is what keeps the
second from happening.
Sourcepub fn is_derived(self) -> bool
pub fn is_derived(self) -> bool
Whether this criterion is derived from other data rather than read off a frontmatter field (WP08 T034 step 4).
Category is the only one. It is derived from status through the board’s
category_map, so a diagnostic that names it as a field points at a field
that does not exist. Any surface printing why a criterion matched, or why
it found nothing, must say so through this.
Sourcepub fn describe(self) -> String
pub fn describe(self) -> String
The criterion as a user should read it in an explanation: category on its
own, or category (derived from status) where the extra clause matters.
Split from [key] so a caller has to choose. A hint bar that appends
“(derived from status)” on every keystroke is noise, and an error that
omits it sends the user hunting for a field; this hands each surface the
short form and lets the ones that explain pick the long one.
Sourcepub fn row(self) -> usize
pub fn row(self) -> usize
Row index of this criterion in FilterField::ALL.
pub fn next(self) -> Self
pub fn prev(self) -> Self
Sourcepub fn value(self, filter: &StructuredFilter) -> Option<&str>
pub fn value(self, filter: &StructuredFilter) -> Option<&str>
The criterion value when set and non-empty. An empty string is treated as “no criterion” everywhere (canonical invariant), so the filter modal can edit a slot without a live-match surprise.
Sourcepub fn value_mut(self, filter: &mut StructuredFilter) -> &mut String
pub fn value_mut(self, filter: &mut StructuredFilter) -> &mut String
Mutable access to the criterion buffer, materializing an empty one
when the criterion is unset (the filter modal types into it and
StructuredFilter::normalize promotes empty back to None).
Sourcepub fn unset(self, filter: &mut StructuredFilter)
pub fn unset(self, filter: &mut StructuredFilter)
Clear the criterion back to None.
Sourcepub fn is_reference(self) -> bool
pub fn is_reference(self) -> bool
Whether this criterion is a parent reference rather than a text field.
The distinction drives two things: the free-typing path is bypassed in
favour of the issue picker (WP06 T026), and evaluate compares exactly
rather than by substring, because a number must not match a longer number
that merely contains it.
Trait Implementations§
Source§impl Clone for FilterField
impl Clone for FilterField
impl Copy for FilterField
Source§impl Debug for FilterField
impl Debug for FilterField
impl Eq for FilterField
Source§impl PartialEq for FilterField
impl PartialEq for FilterField
impl StructuralPartialEq for FilterField
Auto Trait Implementations§
impl Freeze for FilterField
impl RefUnwindSafe for FilterField
impl Send for FilterField
impl Sync for FilterField
impl Unpin for FilterField
impl UnsafeUnpin for FilterField
impl UnwindSafe for FilterField
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 more