Skip to main content

BulkTagEditorState

Struct BulkTagEditorState 

Source
pub struct BulkTagEditorState {
    pub rows: Vec<BulkTagRow>,
    pub aliases: Vec<String>,
    pub skipped_included: Vec<String>,
    pub new_tag_input: Option<String>,
    pub new_tag_cursor: usize,
    pub initial_actions: Vec<BulkTagAction>,
}
Expand description

Snapshot state for the bulk tag editor overlay.

Fields§

§rows: Vec<BulkTagRow>§aliases: Vec<String>

Aliases being edited, snapshot at open time so selection changes during the flow do not affect the in-progress edit.

§skipped_included: Vec<String>

Aliases that live in an Include file and cannot be edited in place. Surfaced in the header so the user sees the blast radius.

§new_tag_input: Option<String>

Draft name for a brand-new tag being typed by the user. None when the input bar is inactive. Newly entered tags are appended to rows with action = AddToAll.

§new_tag_cursor: usize§initial_actions: Vec<BulkTagAction>

Snapshot of rows[i].action at editor open time. Used by is_dirty to detect pending changes on Esc and prompt the user before discarding. Captured by the opener (e.g. App::open_bulk_tag_editor) after rows is populated.

Length-mismatch semantics: any extra row beyond the baseline length (i.e. a newly added tag via +) counts as dirty if its action is non-Leave. This matches the user’s intuition that “I typed a new tag, closing now should warn me”.

Implementations§

Source§

impl BulkTagEditorState

Source

pub fn is_dirty(&self) -> bool

Returns true if any row’s action differs from the open-time baseline, or if rows have been added since open.

Single source of truth for the dirty check. The handler consults this on Esc to decide between immediate exit and discard confirmation. Every editable surface gets a dirty-check so Esc never drops unsaved work.

Invariant: rows is append-only after open_bulk_tag_editor captures the baseline. The + new tag flow only appends to rows; no code path removes rows during the editor session. If a future change introduces row removal, the length-mismatch branch below will silently treat the missing baseline rows as clean (because zip stops at the shorter slice). At that point this method needs an explicit shrink branch; the assertion below guards the assumption.

Trait Implementations§

Source§

impl Debug for BulkTagEditorState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BulkTagEditorState

Source§

fn default() -> BulkTagEditorState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V