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,
) -> DiffPresentation
pub fn new( document: Arc<DiffDocument>, options: PresentationOptions, ) -> DiffPresentation
Indexes a document once for O(1) row lookup and slicing.
Sourcepub fn with_projection(
document: Arc<DiffDocument>,
options: PresentationOptions,
projection: &ContentProjection,
) -> DiffPresentation
pub fn with_projection( document: Arc<DiffDocument>, options: PresentationOptions, projection: &ContentProjection, ) -> DiffPresentation
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 cell_context<'a>( &'a self, row: &PresentedRow, cell: &'a PresentedCell, ) -> CellContext<'a>
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 moreAuto Trait Implementations§
impl Freeze for DiffPresentation
impl RefUnwindSafe for DiffPresentation
impl Send for DiffPresentation
impl Sync for DiffPresentation
impl Unpin for DiffPresentation
impl UnsafeUnpin for DiffPresentation
impl UnwindSafe for DiffPresentation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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