Skip to main content

Item

Struct Item 

Source
pub struct Item { /* private fields */ }
Expand description

One worktree, or a local branch with no worktree, and what the plan does with it. Only plan and plan_worktree make one, and a caller can read but never change it, so execute only ever removes what the plan judged safe:

ⓘ
plan.items()[0].action = Action::Remove;

Implementations§

Source§

impl Item

Source

pub fn path(&self) -> Option<&Path>

The worktree, or None for a branch with no worktree

Source

pub fn branch(&self) -> Option<&str>

Its branch, or None for a detached worktree

Source

pub fn state(&self) -> State

How far its work landed

Source

pub fn action(&self) -> Action

What execute does with it

Source

pub fn oid(&self) -> &str

The commit the plan judged

Source

pub fn deletes_branch(&self) -> bool

Whether removing it also deletes its branch, which it does only when every worktree on that branch goes

Source

pub fn discards_changes(&self) -> bool

Whether removing it drops edits or untracked files, which only Options::force allows

Trait Implementations§

Source§

impl Debug for Item

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Item

§

impl Freeze for Item
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for Item

§

impl RefUnwindSafe for Item

§

impl Send for Item
where RawVecInner: Send,

§

impl Sync for Item
where RawVecInner: Sync,

§

impl Unpin for Item
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Item

§

impl UnwindSafe for Item
where RawVecInner: UnwindSafe,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.