Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 23 fields pub repos: Vec<Repo>, pub repo_list: SearchableList, pub loading_repos: bool, pub selected_repo_idx: Option<usize>, pub branches: Vec<BranchEntry>, pub branch_list: SearchableList, pub base_branch_selection: Option<BaseBranchSelection>, pub help_overlay: Option<HelpOverlayState>, pub setup: Option<SetupState>, pub split_command: Option<String>, pub mode: Mode, pub loading_branches: bool, pub fetching_remotes: bool, pub error: Option<String>, pub pending_worktree_deletes: Vec<PendingWorktreeDelete>, pub session_activity: HashMap<String, u64>, pub agent_poller_cancel: Option<Arc<AtomicBool>>, pub agent_enabled: bool, pub agent_poll_interval: Duration, pub agent_labels: AgentLabelsConfig, pub current_repo_path: Option<PathBuf>, pub cwd_worktree_path: Option<PathBuf>, pub seen_repo_paths: HashSet<PathBuf>, /* private fields */
}
Expand description

Central application state. Components read from this, actions modify it.

Fields§

§repos: Vec<Repo>§repo_list: SearchableList§loading_repos: bool§selected_repo_idx: Option<usize>§branches: Vec<BranchEntry>§branch_list: SearchableList§base_branch_selection: Option<BaseBranchSelection>§help_overlay: Option<HelpOverlayState>§setup: Option<SetupState>§split_command: Option<String>§mode: Mode§loading_branches: bool§fetching_remotes: bool§error: Option<String>§pending_worktree_deletes: Vec<PendingWorktreeDelete>§session_activity: HashMap<String, u64>§agent_poller_cancel: Option<Arc<AtomicBool>>

Cancel token for the active agent status poller thread. Setting this flag stops the current poller; clearing it (via cancel_agent_poller) prepares for a new one.

§agent_enabled: bool

Whether agent status detection is enabled (configurable via [agent] enabled).

§agent_poll_interval: Duration

Agent poll interval (configurable via [agent] poll_interval_ms).

§agent_labels: AgentLabelsConfig

Label text for each agent state shown in the branch picker.

§current_repo_path: Option<PathBuf>

Main repo root path from CWD (for repo ordering)

§cwd_worktree_path: Option<PathBuf>

CWD resolved to repo/worktree root (for branch current detection)

§seen_repo_paths: HashSet<PathBuf>

Tracks repo paths already seen during streaming discovery (O(1) dedup). Cleared when a new scan starts.

Implementations§

Source§

impl AppState

Source

pub fn new(repos: Vec<Repo>, split_command: Option<String>) -> Self

Source

pub fn new_loading(loading_message: &str, split_command: Option<String>) -> Self

Source

pub fn set_error(&mut self, msg: &str)

Source

pub fn clear_error(&mut self)

Source

pub fn new_setup() -> Self

Source

pub fn cancel_agent_poller(&mut self)

Signal the current agent poller thread to stop and clear the cancel token.

Source

pub fn active_text_input(&mut self) -> Option<&mut TextInput>

Get the active text input for the current mode (mutable). Works for both SearchableList modes and Setup mode.

Source

pub fn active_list_mut(&mut self) -> Option<&mut SearchableList>

Get the active searchable list for the current mode (mutable)

Source

pub fn active_list(&self) -> Option<&SearchableList>

Get the active searchable list for the current mode (immutable)

Source

pub fn active_help_list_mut(&mut self) -> Option<&mut SearchableList>

Source

pub fn active_help_list(&self) -> Option<&SearchableList>

Source

pub fn is_branch_pending_delete( &self, repo_path: &Path, branch_name: &str, ) -> bool

Source

pub fn set_active_list_page_rows(&mut self, rows: usize)

Source

pub fn active_list_page_rows(&self) -> usize

Source

pub fn mark_pending_worktree_delete(&mut self, pending: PendingWorktreeDelete)

Source

pub fn clear_pending_worktree_delete_by_path( &mut self, worktree_path: &Path, ) -> bool

Source

pub fn clear_pending_worktree_delete_by_branch( &mut self, repo_path: &Path, branch_name: &str, ) -> bool

Source

pub fn reconcile_pending_worktree_deletes(&mut self) -> bool

Drop stale pending delete entries that no longer correspond to an existing worktree.

Trait Implementations§

Source§

impl Clone for AppState

Source§

fn clone(&self) -> AppState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppState

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.