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
impl DiffPresentation
Sourcepub fn new(document: Arc<DiffDocument>, options: PresentationOptions) -> Self
pub fn new(document: Arc<DiffDocument>, options: PresentationOptions) -> Self
Indexes a document once for O(1) row lookup and slicing.
Sourcepub fn with_projection(
document: Arc<DiffDocument>,
options: PresentationOptions,
projection: &ContentProjection,
) -> Self
pub fn with_projection( document: Arc<DiffDocument>, options: PresentationOptions, projection: &ContentProjection, ) -> Self
Builds a windowed projection over the document’s complete-file sources.
Sourcepub const fn document(&self) -> &Arc<DiffDocument> ⓘ
pub const fn document(&self) -> &Arc<DiffDocument> ⓘ
Returns the retained immutable snapshot.
pub const fn layout(&self) -> Layout
Sourcepub fn row(&self, index: usize) -> Option<&PresentedRow>
pub fn row(&self, index: usize) -> Option<&PresentedRow>
Returns one row in O(1).
Sourcepub fn rows(&self, range: Range<usize>) -> &[PresentedRow]
pub fn rows(&self, range: Range<usize>) -> &[PresentedRow]
Returns a clamped visible row slice without allocating.
Sourcepub fn file_range(&self, file_index: usize) -> Option<Range<usize>>
pub fn file_range(&self, file_index: usize) -> Option<Range<usize>>
Returns the row range occupied by a file.
Sourcepub fn hunk_range(
&self,
file_index: usize,
hunk_index: usize,
) -> Option<Range<usize>>
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.
pub fn cell_anchor( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<LineAnchor>
pub fn anchor_at(&self, row_index: usize, side: DiffSide) -> Option<LineAnchor>
Sourcepub fn source_document(
&self,
row: &PresentedRow,
cell: &PresentedCell,
) -> Option<&SourceDocument>
pub fn source_document( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<&SourceDocument>
Returns the immutable complete source containing cell.
Sourcepub fn source_path<'a>(
&'a self,
row: &PresentedRow,
cell: &PresentedCell,
) -> Option<&'a str>
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.
Sourcepub fn hunk_sequence<'a>(
&'a self,
row: &PresentedRow,
cell: &PresentedCell,
) -> Option<HunkSequence<'a>>
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.
pub fn language_at(&self, row_index: usize) -> &str
Sourcepub fn row_path(&self, row: &PresentedRow) -> &str
pub fn row_path(&self, row: &PresentedRow) -> &str
Repository path of the file a row belongs to, usable as a language hint.
Sourcepub fn row_showing_anchor(&self, anchor: &LineAnchor) -> Option<usize>
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.
pub fn source_location( &self, row: &PresentedRow, cell: &PresentedCell, ) -> Option<SourceLocation>
pub fn row_showing_source(&self, location: &SourceLocation) -> Option<usize>
pub fn gap_info(&self, row_index: usize) -> Option<&GapInfo>
pub fn row_shows_anchor(&self, row: &PresentedRow, anchor: &LineAnchor) -> bool
pub fn is_commentable(&self, index: usize) -> bool
Trait Implementations§
Source§impl Clone for DiffPresentation
impl Clone for DiffPresentation
Source§fn clone(&self) -> DiffPresentation
fn clone(&self) -> DiffPresentation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more