Skip to main content

DiffPresentation

Struct DiffPresentation 

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

Eager row indexes and cheap descriptors. Syntax and frontend widgets are not constructed here.

Implementations§

Source§

impl DiffPresentation

Source

pub fn new(document: Arc<DiffDocument>, options: PresentationOptions) -> Self

Indexes a document once for O(1) row lookup and slicing.

Source

pub fn with_projection( document: Arc<DiffDocument>, options: PresentationOptions, projection: &ContentProjection, ) -> Self

Builds a windowed projection over the document’s complete-file sources.

Source

pub const fn document(&self) -> &Arc<DiffDocument>

Returns the retained immutable snapshot.

Source

pub const fn layout(&self) -> Layout

Source

pub fn row_count(&self) -> usize

Total number of rows.

Source

pub fn row(&self, index: usize) -> Option<&PresentedRow>

Returns one row in O(1).

Source

pub fn rows(&self, range: Range<usize>) -> &[PresentedRow]

Returns a clamped visible row slice without allocating.

Source

pub fn file_range(&self, file_index: usize) -> Option<Range<usize>>

Returns the row range occupied by a file.

Source

pub fn hunk_range( &self, file_index: usize, hunk_index: usize, ) -> Option<Range<usize>>

Returns the row range occupied by a hunk, including its header.

Source

pub fn cell_anchor( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<LineAnchor>

Source

pub fn anchor_at(&self, row_index: usize, side: DiffSide) -> Option<LineAnchor>

Source

pub fn source_document( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<&SourceDocument>

Returns the immutable complete source containing cell.

Source

pub fn source_path<'a>( &'a self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<&'a str>

Returns the side-specific repository path used as a syntax language hint.

Source

pub fn hunk_sequence<'a>( &'a self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<HunkSequence<'a>>

Describes the hunk-side line sequence containing a patch cell so hosts can keep multiline syntax context when no complete source exists.

Source

pub fn language_at(&self, row_index: usize) -> &str

Source

pub fn row_path(&self, row: &PresentedRow) -> &str

Repository path of the file a row belongs to, usable as a language hint.

Source

pub fn row_showing_anchor(&self, anchor: &LineAnchor) -> Option<usize>

Returns the presentation row displaying an anchor in O(1) after its file has been located.

Source

pub fn source_location( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<SourceLocation>

Source

pub fn row_showing_source(&self, location: &SourceLocation) -> Option<usize>

Source

pub fn gap_info(&self, row_index: usize) -> Option<&GapInfo>

Source

pub fn row_shows_anchor(&self, row: &PresentedRow, anchor: &LineAnchor) -> bool

Source

pub fn is_commentable(&self, index: usize) -> bool

Source

pub fn is_navigable(&self, index: usize) -> bool

Source

pub fn first_navigable(&self, range: Range<usize>) -> Option<usize>

Source

pub fn last_navigable(&self, range: Range<usize>) -> Option<usize>

Source

pub fn step_navigable( &self, from: usize, backward: bool, range: &Range<usize>, ) -> Option<usize>

Trait Implementations§

Source§

impl Clone for DiffPresentation

Source§

fn clone(&self) -> DiffPresentation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiffPresentation

Source§

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

Formats the value using the given formatter. 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> 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, 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> 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 = !

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.