DiffWidget

Struct DiffWidget 

Source
pub struct DiffWidget {
    pub hunks: Vec<DiffHunk>,
    pub view_type: DiffViewType,
    pub selected_hunk: Option<usize>,
    pub scroll: usize,
    pub approvals: Vec<bool>,
}
Expand description

Diff widget

Fields§

§hunks: Vec<DiffHunk>

Hunks in the diff

§view_type: DiffViewType

Current view type

§selected_hunk: Option<usize>

Selected hunk index

§scroll: usize

Scroll offset

§approvals: Vec<bool>

Approval state for each hunk

Implementations§

Source§

impl DiffWidget

Source

pub fn new() -> Self

Create a new diff widget

Source

pub fn add_hunk(&mut self, hunk: DiffHunk)

Add a hunk

Source

pub fn toggle_view_type(&mut self)

Toggle view type

Source

pub fn select_next_hunk(&mut self)

Select next hunk

Source

pub fn select_prev_hunk(&mut self)

Select previous hunk

Source

pub fn toggle_selected_hunk(&mut self)

Toggle selected hunk collapsed state

Source

pub fn approve_all(&mut self)

Approve all changes

Source

pub fn reject_all(&mut self)

Reject all changes

Source

pub fn approve_hunk(&mut self)

Approve selected hunk

Source

pub fn reject_hunk(&mut self)

Reject selected hunk

Source

pub fn approved_hunks(&self) -> Vec<usize>

Get all approved hunks

Source

pub fn rejected_hunks(&self) -> Vec<usize>

Get all rejected hunks

Source

pub fn scroll_up(&mut self)

Scroll up

Source

pub fn scroll_down(&mut self, height: usize)

Scroll down

Trait Implementations§

Source§

impl Debug for DiffWidget

Source§

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

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

impl Default for DiffWidget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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