Skip to main content

HunkSelectError

Enum HunkSelectError 

Source
pub enum HunkSelectError {
Show 13 variants UnknownId { id: String, }, StaleId { id: HunkId, path: Option<String>, current_ids: Vec<HunkId>, }, WrongSide { id: HunkId, actual_side: DiffSide, requested_side: DiffSide, }, UnselectableSide { side: DiffSide, }, Binary { path: String, }, Apply(ApplyError), RangeOutOfBounds { path: String, start: usize, end: usize, max_line: usize, }, RangeSelectsNothing { path: String, }, Gitlink { path: String, }, InvalidMode { path: String, mode: String, }, MissingPath, Repository(Box<Error>), PatchBuild,
}
Expand description

Failure while resolving or staging hunk ids.

Variants§

§

UnknownId

Id string is not 12 lowercase hex characters.

Fields

§id: String

Raw id token from the caller.

§

StaleId

Id is well-formed but no longer present on the requested side.

Fields

§id: HunkId

The requested id.

§path: Option<String>

Path when the caller narrowed the diff (or a single candidate file).

§current_ids: Vec<HunkId>

Current ids on the same path when cheap to compute.

§

WrongSide

Id belongs to the other index/worktree side (for example staged vs unstaged).

Fields

§id: HunkId

The requested id.

§actual_side: DiffSide

Side the id was computed for.

§requested_side: DiffSide

Side the caller requested.

§

UnselectableSide

Hunks can only be selected on DiffSide::Unstaged or DiffSide::Staged.

Fields

§side: DiffSide

Side the caller requested.

§

Binary

Binary paths cannot be partially staged by hunk id.

Fields

§path: String

Repository-relative path.

§

Apply(ApplyError)

Index apply failed after hunk resolution.

§

RangeOutOfBounds

Line range lies outside the file’s new-side line count.

Fields

§path: String

Path named in the range.

§start: usize

Range start (1-based).

§end: usize

Range end (1-based).

§max_line: usize

Last valid new-side line number.

§

RangeSelectsNothing

Range does not select any additions or deletions.

Fields

§path: String

Path named in the range.

Submodule (gitlink) entries cannot be restored hunk by hunk.

Fields

§path: String

Repository-relative path of the gitlink.

§

InvalidMode

A diff reported a file mode that is not an octal Git mode.

Fields

§path: String

Repository-relative path.

§mode: String

The mode text as reported by the diff.

§

MissingPath

A patch passed in for restoring names neither an old nor a new path.

§

Repository(Box<Error>)

Repository or diff engine failure (not a hunk-id selection error).

Match on the boxed crate::error::Error to branch on the underlying failure, for example crate::error::Error::RequiresWorkTree when the repository is bare.

§

PatchBuild

Selected hunks could not be turned into an apply patch.

Trait Implementations§

Source§

impl Debug for HunkSelectError

Source§

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

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

impl Display for HunkSelectError

Source§

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

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

impl Error for HunkSelectError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ApplyError> for HunkSelectError

Source§

fn from(source: ApplyError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for HunkSelectError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<HunkSelectError> for CommitPatchError

Source§

fn from(source: HunkSelectError) -> Self

Converts to this type from the input type.
Source§

impl From<HunkSelectError> for Error

Source§

fn from(source: HunkSelectError) -> Self

Converts to this type from the input type.
Source§

impl From<HunkSelectError> for HistoryError

Source§

fn from(source: HunkSelectError) -> Self

Converts to this type from the input type.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.