Stack

Struct Stack 

Source
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: Uuid

Unique identifier for this stack

§name: String

Human-readable name for the stack

§description: Option<String>

Description of what this stack implements

§base_branch: String

Base 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: StackStatus

Current 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: bool

Whether this stack is active (current working stack)

Implementations§

Source§

impl Stack

Source

pub fn new( name: String, base_branch: String, description: Option<String>, ) -> Self

Create a new empty stack

Source

pub fn push_entry( &mut self, branch: String, commit_hash: String, message: String, ) -> Uuid

Add a new entry to the top of the stack

Source

pub fn pop_entry(&mut self) -> Option<StackEntry>

Remove the top entry from the stack

Source

pub fn get_entry(&self, id: &Uuid) -> Option<&StackEntry>

Get an entry by ID

Source

pub fn get_entry_mut(&mut self, id: &Uuid) -> Option<&mut StackEntry>

Get a mutable entry by ID

Source

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

Source

pub fn get_base_entry(&self) -> Option<&StackEntry>

Get the base (first) entry of the stack

Source

pub fn get_top_entry(&self) -> Option<&StackEntry>

Get the top (last) entry of the stack

Source

pub fn get_children(&self, entry_id: &Uuid) -> Vec<&StackEntry>

Get all entries that are children of the given entry

Source

pub fn get_parent(&self, entry_id: &Uuid) -> Option<&StackEntry>

Get the parent of the given entry

Source

pub fn is_empty(&self) -> bool

Check if the stack is empty

Source

pub fn len(&self) -> usize

Get the number of entries in the stack

Source

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

Source

pub fn repair_data_consistency(&mut self)

Force synchronization of entries from entry_map (public method for fixing corrupted data)

Source

pub fn mark_entry_synced(&mut self, entry_id: &Uuid) -> bool

Mark an entry as synced

Source

pub fn mark_entry_merged(&mut self, entry_id: &Uuid, merged: bool) -> bool

Mark an entry as merged (or unmerged)

Source

pub fn update_status(&mut self, status: StackStatus)

Update stack status

Source

pub fn set_active(&mut self, active: bool)

Set this stack as active

Source

pub fn get_branch_names(&self) -> Vec<String>

Get all branch names in this stack

Source

pub fn validate(&self) -> Result<String, String>

Validate the stack structure and Git state integrity

Source

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 Clone for Stack

Source§

fn clone(&self) -> Stack

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 Stack

Source§

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

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

impl<'de> Deserialize<'de> for Stack

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 Serialize for Stack

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

Auto Trait Implementations§

§

impl Freeze for Stack

§

impl RefUnwindSafe for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnwindSafe for Stack

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,