pub struct Stack {
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub base_branch: String,
pub working_branch: Option<String>,
pub entries: Vec<StackEntry>,
pub entry_map: HashMap<Uuid, StackEntry>,
pub status: StackStatus,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub is_active: bool,
}Expand description
Represents a complete stack of commits
Fields§
§id: UuidUnique identifier for this stack
name: StringHuman-readable name for the stack
description: Option<String>Description of what this stack implements
base_branch: StringBase branch this stack is built on
working_branch: Option<String>Working branch where commits are made (e.g., feature-1)
entries: Vec<StackEntry>All entries in this stack (ordered)
entry_map: HashMap<Uuid, StackEntry>Map of entry ID to entry for quick lookup
status: StackStatusCurrent status of the stack
created_at: DateTime<Utc>When this stack was created
updated_at: DateTime<Utc>When this stack was last updated
is_active: boolWhether this stack is active (current working stack)
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn new(
name: String,
base_branch: String,
description: Option<String>,
) -> Self
pub fn new( name: String, base_branch: String, description: Option<String>, ) -> Self
Create a new empty stack
Sourcepub fn push_entry(
&mut self,
branch: String,
commit_hash: String,
message: String,
) -> Uuid
pub fn push_entry( &mut self, branch: String, commit_hash: String, message: String, ) -> Uuid
Add a new entry to the top of the stack
Sourcepub fn pop_entry(&mut self) -> Option<StackEntry>
pub fn pop_entry(&mut self) -> Option<StackEntry>
Remove the top entry from the stack
Sourcepub fn remove_entry_at(&mut self, index: usize) -> Option<StackEntry>
pub fn remove_entry_at(&mut self, index: usize) -> Option<StackEntry>
Remove an entry by 0-based index, reparenting children to the removed entry’s parent
Sourcepub fn get_entry(&self, id: &Uuid) -> Option<&StackEntry>
pub fn get_entry(&self, id: &Uuid) -> Option<&StackEntry>
Get an entry by ID
Sourcepub fn get_entry_mut(&mut self, id: &Uuid) -> Option<&mut StackEntry>
pub fn get_entry_mut(&mut self, id: &Uuid) -> Option<&mut StackEntry>
Get a mutable entry by ID
Sourcepub fn update_entry_commit_hash(
&mut self,
entry_id: &Uuid,
new_commit_hash: String,
) -> Result<(), String>
pub fn update_entry_commit_hash( &mut self, entry_id: &Uuid, new_commit_hash: String, ) -> Result<(), String>
Update an entry’s commit hash in both entries Vec and entry_map This ensures the two data structures stay in sync
Sourcepub fn get_base_entry(&self) -> Option<&StackEntry>
pub fn get_base_entry(&self) -> Option<&StackEntry>
Get the base (first) entry of the stack
Sourcepub fn get_top_entry(&self) -> Option<&StackEntry>
pub fn get_top_entry(&self) -> Option<&StackEntry>
Get the top (last) entry of the stack
Sourcepub fn get_children(&self, entry_id: &Uuid) -> Vec<&StackEntry>
pub fn get_children(&self, entry_id: &Uuid) -> Vec<&StackEntry>
Get all entries that are children of the given entry
Sourcepub fn get_parent(&self, entry_id: &Uuid) -> Option<&StackEntry>
pub fn get_parent(&self, entry_id: &Uuid) -> Option<&StackEntry>
Get the parent of the given entry
Sourcepub fn mark_entry_submitted(
&mut self,
entry_id: &Uuid,
pull_request_id: String,
) -> bool
pub fn mark_entry_submitted( &mut self, entry_id: &Uuid, pull_request_id: String, ) -> bool
Mark an entry as submitted with a pull request ID
Sourcepub fn repair_data_consistency(&mut self)
pub fn repair_data_consistency(&mut self)
Force synchronization of entries from entry_map (public method for fixing corrupted data)
Sourcepub fn mark_entry_synced(&mut self, entry_id: &Uuid) -> bool
pub fn mark_entry_synced(&mut self, entry_id: &Uuid) -> bool
Mark an entry as synced
Sourcepub fn mark_entry_merged(&mut self, entry_id: &Uuid, merged: bool) -> bool
pub fn mark_entry_merged(&mut self, entry_id: &Uuid, merged: bool) -> bool
Mark an entry as merged (or unmerged)
Sourcepub fn update_status(&mut self, status: StackStatus)
pub fn update_status(&mut self, status: StackStatus)
Update stack status
Sourcepub fn set_active(&mut self, active: bool)
pub fn set_active(&mut self, active: bool)
Set this stack as active
Sourcepub fn get_branch_names(&self) -> Vec<String>
pub fn get_branch_names(&self) -> Vec<String>
Get all branch names in this stack
Sourcepub fn validate(&self) -> Result<String, String>
pub fn validate(&self) -> Result<String, String>
Validate the stack structure and Git state integrity
Sourcepub fn validate_git_integrity(
&self,
git_repo: &GitRepository,
) -> Result<String, String>
pub fn validate_git_integrity( &self, git_repo: &GitRepository, ) -> Result<String, String>
Validate Git state integrity (requires Git repository access) This checks that branch HEADs match the expected commit hashes
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Stack
impl<'de> Deserialize<'de> for Stack
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnsafeUnpin for Stack
impl UnwindSafe for Stack
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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