Skip to main content

DetectContext

Struct DetectContext 

Source
pub struct DetectContext<'a> {
    pub current_branch: &'a str,
    pub home_branch: &'a str,
    pub working_dir: &'a WorkingDirState,
    pub sync_state: &'a SyncState,
    pub pr_info: Option<&'a PrInfo>,
    pub has_remote: bool,
    pub base_pr_merged: Option<&'a str>,
    pub recorded_base: Option<&'a str>,
    pub recorded_base_merged: bool,
    pub recorded_base_sha: Option<&'a str>,
    pub base_ref: &'a str,
    pub behind_base: usize,
}
Expand description

Inputs for NextAction::detect. Bundled into a struct because the detected state depends on many independent signals; named fields keep call sites legible and let new signals be added without churning every caller.

Fields§

§current_branch: &'a str§home_branch: &'a str§working_dir: &'a WorkingDirState§sync_state: &'a SyncState§pr_info: Option<&'a PrInfo>§has_remote: bool§base_pr_merged: Option<&'a str>

This branch’s PR’s base was merged (post-PR restack trigger).

§recorded_base: Option<&'a str>

Locally recorded stacked base (gw new --stack), filtered to a real parent. Drives the -B <base> create-PR suggestion before a PR exists.

§recorded_base_merged: bool

The recorded base’s PR has already merged (stale stacked base): the branch should rebase onto the default branch and open a normal PR.

§recorded_base_sha: Option<&'a str>

Recorded base tip SHA (gw new --stack); the --onto boundary that survives the base branch being deleted.

§base_ref: &'a str

The ref this branch should sit on: the stacked parent while one is in flight, else the default branch (origin/main). Display only.

§behind_base: usize

Commits on base_ref that this branch does not have.

Auto Trait Implementations§

§

impl<'a> Freeze for DetectContext<'a>

§

impl<'a> RefUnwindSafe for DetectContext<'a>

§

impl<'a> Send for DetectContext<'a>

§

impl<'a> Sync for DetectContext<'a>

§

impl<'a> Unpin for DetectContext<'a>

§

impl<'a> UnsafeUnpin for DetectContext<'a>

§

impl<'a> UnwindSafe for DetectContext<'a>

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, 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.