pub struct DiffSignMap { /* private fields */ }Expand description
Sparse per-line classification of the current-side rope.
Keyed by source line index (0-based, into the current
rope — i.e., the line the user is looking at). Sparse
because most lines have no sign. entries is sorted by
line so renderer-side lookup (per-row) is O(log n) via
binary search.
Build via compute_diff_sign_map — pure function of an
Arc<HunkIndex>. Published per-session via
DiffSession::sign_map_cell (D.3.d.0); the
DiffOverlayRefreshTask refreshes it on every hunk
publish so renderers see consistent decorations.
Implementations§
Source§impl DiffSignMap
impl DiffSignMap
pub fn entries(&self) -> &[(u32, DiffSignKind)]
pub fn revision(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn from_entries(entries: Vec<(u32, DiffSignKind)>) -> DiffSignMap
pub fn from_entries(entries: Vec<(u32, DiffSignKind)>) -> DiffSignMap
Build a sign map directly from (line, kind) entries (revision
0), for producers that classify lines without a HunkIndex to
walk — a buffer whose content is already a unified diff
(magit’s diff / revision / stash-show / commit views) knows each
line’s kind by reading it, and has no baseline to diff against.
entries MUST be sorted ascending by line: Self::sign_at is
a binary search, so an unsorted vec silently mis-reports signs
rather than failing.
Sourcepub fn sign_at(&self, line: u32) -> Option<DiffSignKind>
pub fn sign_at(&self, line: u32) -> Option<DiffSignKind>
Lookup the sign for line, if any. O(log n) binary
search over entries. Renderer hot path.
Trait Implementations§
Source§impl Clone for DiffSignMap
impl Clone for DiffSignMap
Source§fn clone(&self) -> DiffSignMap
fn clone(&self) -> DiffSignMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiffSignMap
impl Debug for DiffSignMap
Source§impl Default for DiffSignMap
impl Default for DiffSignMap
Source§fn default() -> DiffSignMap
fn default() -> DiffSignMap
Auto Trait Implementations§
impl Freeze for DiffSignMap
impl RefUnwindSafe for DiffSignMap
impl Send for DiffSignMap
impl Sync for DiffSignMap
impl Unpin for DiffSignMap
impl UnsafeUnpin for DiffSignMap
impl UnwindSafe for DiffSignMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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