Skip to main content

BranchEntry

Struct BranchEntry 

Source
pub struct BranchEntry {
    pub name: String,
    pub worktree_path: Option<PathBuf>,
    pub has_session: bool,
    pub is_current: bool,
    pub is_default: bool,
    pub remote: Option<String>,
    pub session_activity_ts: Option<u64>,
    pub agent_status: Option<AgentStatus>,
}
Expand description

Rich branch entry with worktree and session metadata

Fields§

§name: String§worktree_path: Option<PathBuf>

If a worktree already exists for this branch

§has_session: bool§is_current: bool§is_default: bool

Whether this is the default branch (main/master)

§remote: Option<String>

The remote this branch comes from, if it is a remote-only branch.

§session_activity_ts: Option<u64>

Last activity timestamp for the session (if any)

§agent_status: Option<AgentStatus>

Status of any AI agent running in the session

Implementations§

Source§

impl BranchEntry

Source

pub fn build( repo: &Repo, branch_names: &[String], active_sessions: &[String], ) -> Vec<Self>

Build branch entries from a repo’s branches, worktrees, and active tmux sessions (unsorted).

Source

pub fn build_sorted( repo: &Repo, branch_names: &[String], active_sessions: &[String], ) -> Vec<Self>

Build sorted branch entries from a repo’s branches, worktrees, and active tmux sessions.

Sorted by: sessions first, then worktrees, then alphabetical.

Source

pub fn build_sorted_with_activity( repo: &Repo, branch_names: &[String], active_sessions: &[String], default_branch: Option<&str>, session_activity: &HashMap<String, u64>, cwd: Option<&Path>, ) -> Vec<Self>

Build sorted branch entries with activity timestamps and default branch info.

cwd is the user’s current working directory (resolved to a repo/worktree root). When it matches a worktree path, that worktree’s branch is marked as current. Falls back to the main worktree’s branch when cwd is None or doesn’t match.

Source

pub fn build_remote( remote: &str, remote_names: &[String], local_names: &[String], ) -> Vec<Self>

Build remote-only branch entries, skipping branches that already exist locally.

Source

pub fn sort_entries(entries: &mut [Self])

Trait Implementations§

Source§

impl Clone for BranchEntry

Source§

fn clone(&self) -> BranchEntry

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 BranchEntry

Source§

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

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

impl<'de> Deserialize<'de> for BranchEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for BranchEntry

Source§

fn eq(&self, other: &BranchEntry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BranchEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for BranchEntry

Source§

impl StructuralPartialEq for BranchEntry

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,