pub struct BulkSelection { /* private fields */ }Expand description
The multi-selection: an ordered, de-duplicated set of issue numbers.
Order is the order the user marked them, not the board’s column order, and not numeric order. A user marks what they can see, and a plan that reorders what they marked is a plan they did not read.
Implementations§
Source§impl BulkSelection
impl BulkSelection
pub fn new() -> Self
Sourcepub fn toggle(&mut self, number: u32) -> Result<bool, SelectionProblem>
pub fn toggle(&mut self, number: u32) -> Result<bool, SelectionProblem>
Add an issue, refusing a duplicate and refusing past the bound.
Both refusals are Err rather than a silent false, because a silent false
for “too many” is a keystroke that appeared to do nothing, and a user
counting their selection has no way to know which press was dropped.
Sourcepub fn remove(&mut self, number: u32) -> bool
pub fn remove(&mut self, number: u32) -> bool
Remove an issue, reporting whether it was there.
bool rather than Result: removing something that is not selected is the
desired end state, and a user pressing x twice means “not selected”, not
“something went wrong”.
pub fn contains(&self, number: u32) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
The one-line header a surface shows.
The count and the bound, so a user who hit the ceiling can see where they are without counting the marks themselves.
Sourcepub fn to_selection(&self, issues: &[(u32, Issue)]) -> (Selection, Vec<u32>)
pub fn to_selection(&self, issues: &[(u32, Issue)]) -> (Selection, Vec<u32>)
The Selection a plan is built from, in the marked order.
Takes the issues rather than a store, because the TUI already has them: it has read the board to draw the cards. Re-resolving through selectors would be a second selection path, and it would produce a different order.
Issues whose number is not in issues are dropped rather than refused.
The board may have been filtered between marking and previewing, and a
preview that refuses because a card went out of view is a preview the user
cannot get at all. The dropped number is reported in the note, so “3 of your
5 are still visible” is visible rather than inferred.
Trait Implementations§
Source§impl Clone for BulkSelection
impl Clone for BulkSelection
Source§impl Debug for BulkSelection
impl Debug for BulkSelection
Source§impl Default for BulkSelection
impl Default for BulkSelection
impl Eq for BulkSelection
Source§impl PartialEq for BulkSelection
impl PartialEq for BulkSelection
impl StructuralPartialEq for BulkSelection
Auto Trait Implementations§
impl Freeze for BulkSelection
impl RefUnwindSafe for BulkSelection
impl Send for BulkSelection
impl Sync for BulkSelection
impl Unpin for BulkSelection
impl UnsafeUnpin for BulkSelection
impl UnwindSafe for BulkSelection
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