pub struct CodebaseDiff { /* private fields */ }Expand description
Represents the differences between two states of a codebase, typically used for incremental analysis.
This structure uses a single fingerprint hash per symbol to determine changes. Any change to a symbol (signature, body, modifiers, attributes) produces a different hash, triggering re-analysis.
Provides a comprehensive API for modification and querying following established conventions.
Implementations§
Source§impl CodebaseDiff
impl CodebaseDiff
pub fn new() -> Self
Sourcepub fn get_keep(&self) -> &HashSet<SymbolIdentifier>
pub fn get_keep(&self) -> &HashSet<SymbolIdentifier>
Returns a reference to the set of symbols/members to keep unchanged.
Sourcepub fn get_changed(&self) -> &HashSet<SymbolIdentifier>
pub fn get_changed(&self) -> &HashSet<SymbolIdentifier>
Returns a reference to the set of changed symbols/members.
Sourcepub fn get_diff_map(&self) -> &HashMap<FileId, Vec<DiffHunk>>
pub fn get_diff_map(&self) -> &HashMap<FileId, Vec<DiffHunk>>
Returns a reference to the map of source files to text diff hunks.
Sourcepub fn get_deletion_ranges_map(&self) -> &HashMap<FileId, Vec<DeletionRange>>
pub fn get_deletion_ranges_map(&self) -> &HashMap<FileId, Vec<DeletionRange>>
Returns a reference to the map of source files to deletion ranges.
Sourcepub fn set_keep(&mut self, keep_set: impl IntoIterator<Item = SymbolIdentifier>)
pub fn set_keep(&mut self, keep_set: impl IntoIterator<Item = SymbolIdentifier>)
Sets the ‘keep’ set, replacing the existing one.
Sourcepub fn with_keep(
self,
keep_set: impl IntoIterator<Item = SymbolIdentifier>,
) -> Self
pub fn with_keep( self, keep_set: impl IntoIterator<Item = SymbolIdentifier>, ) -> Self
Returns a new instance with the ‘keep’ set replaced.
Sourcepub fn add_keep_entry(&mut self, entry: SymbolIdentifier) -> bool
pub fn add_keep_entry(&mut self, entry: SymbolIdentifier) -> bool
Adds a single entry to the ‘keep’ set. Returns true if the entry was not already present.
Sourcepub fn with_added_keep_entry(self, entry: SymbolIdentifier) -> Self
pub fn with_added_keep_entry(self, entry: SymbolIdentifier) -> Self
Returns a new instance with the entry added to the ‘keep’ set.
Sourcepub fn add_keep_entries(
&mut self,
entries: impl IntoIterator<Item = SymbolIdentifier>,
)
pub fn add_keep_entries( &mut self, entries: impl IntoIterator<Item = SymbolIdentifier>, )
Adds multiple entries to the ‘keep’ set.
Sourcepub fn with_added_keep_entries(
self,
entries: impl IntoIterator<Item = SymbolIdentifier>,
) -> Self
pub fn with_added_keep_entries( self, entries: impl IntoIterator<Item = SymbolIdentifier>, ) -> Self
Returns a new instance with multiple entries added to the ‘keep’ set.
Sourcepub fn unset_keep(&mut self)
pub fn unset_keep(&mut self)
Clears the ‘keep’ set.
Sourcepub fn without_keep(self) -> Self
pub fn without_keep(self) -> Self
Returns a new instance with an empty ‘keep’ set.
Sourcepub fn set_changed(
&mut self,
change_set: impl IntoIterator<Item = SymbolIdentifier>,
)
pub fn set_changed( &mut self, change_set: impl IntoIterator<Item = SymbolIdentifier>, )
Sets the ‘changed’ set, replacing the existing one.
Sourcepub fn with_changed(
self,
change_set: impl IntoIterator<Item = SymbolIdentifier>,
) -> Self
pub fn with_changed( self, change_set: impl IntoIterator<Item = SymbolIdentifier>, ) -> Self
Returns a new instance with the ‘changed’ set replaced.
Sourcepub fn add_changed_entry(&mut self, entry: SymbolIdentifier) -> bool
pub fn add_changed_entry(&mut self, entry: SymbolIdentifier) -> bool
Adds a single entry to the ‘changed’ set. Returns true if the entry was not already present.
Sourcepub fn contains_changed_entry(&self, entry: &SymbolIdentifier) -> bool
pub fn contains_changed_entry(&self, entry: &SymbolIdentifier) -> bool
Checks if the ‘changed’ set contains a specific entry.
Sourcepub fn with_added_changed_entry(self, entry: SymbolIdentifier) -> Self
pub fn with_added_changed_entry(self, entry: SymbolIdentifier) -> Self
Returns a new instance with the entry added to the ‘changed’ set.
Sourcepub fn add_changed_entries(
&mut self,
entries: impl IntoIterator<Item = SymbolIdentifier>,
)
pub fn add_changed_entries( &mut self, entries: impl IntoIterator<Item = SymbolIdentifier>, )
Adds multiple entries to the ‘changed’ set.
Sourcepub fn with_added_changed_entries(
self,
entries: impl IntoIterator<Item = SymbolIdentifier>,
) -> Self
pub fn with_added_changed_entries( self, entries: impl IntoIterator<Item = SymbolIdentifier>, ) -> Self
Returns a new instance with multiple entries added to the ‘changed’ set.
Sourcepub fn unset_changed(&mut self)
pub fn unset_changed(&mut self)
Clears the ‘changed’ set.
Sourcepub fn without_changed(self) -> Self
pub fn without_changed(self) -> Self
Returns a new instance with an empty ‘changed’ set.
Sourcepub fn set_diff_map(&mut self, map: HashMap<FileId, Vec<DiffHunk>>)
pub fn set_diff_map(&mut self, map: HashMap<FileId, Vec<DiffHunk>>)
Sets the diff map, replacing the existing one.
Sourcepub fn with_diff_map(self, map: HashMap<FileId, Vec<DiffHunk>>) -> Self
pub fn with_diff_map(self, map: HashMap<FileId, Vec<DiffHunk>>) -> Self
Returns a new instance with the diff map replaced.
Sourcepub fn add_diff_map_entry(
&mut self,
source: FileId,
diffs: Vec<DiffHunk>,
) -> Option<Vec<DiffHunk>>
pub fn add_diff_map_entry( &mut self, source: FileId, diffs: Vec<DiffHunk>, ) -> Option<Vec<DiffHunk>>
Adds or replaces the diff hunks for a specific source file. Returns previous hunks if any.
Sourcepub fn with_added_diff_map_entry(
self,
source: FileId,
diffs: Vec<DiffHunk>,
) -> Self
pub fn with_added_diff_map_entry( self, source: FileId, diffs: Vec<DiffHunk>, ) -> Self
Returns a new instance with the diff hunks for the source file added or updated.
Sourcepub fn add_diffs_for_source(
&mut self,
source: FileId,
diffs: impl IntoIterator<Item = DiffHunk>,
)
pub fn add_diffs_for_source( &mut self, source: FileId, diffs: impl IntoIterator<Item = DiffHunk>, )
Extends the diff hunks for a specific source file.
Sourcepub fn with_added_diffs_for_source(
self,
source: FileId,
diffs: impl IntoIterator<Item = DiffHunk>,
) -> Self
pub fn with_added_diffs_for_source( self, source: FileId, diffs: impl IntoIterator<Item = DiffHunk>, ) -> Self
Returns a new instance with the diff hunks for the source file extended.
Sourcepub fn unset_diff_map(&mut self)
pub fn unset_diff_map(&mut self)
Clears the diff map.
Sourcepub fn without_diff_map(self) -> Self
pub fn without_diff_map(self) -> Self
Returns a new instance with an empty diff map.
Sourcepub fn set_deletion_ranges_map(
&mut self,
map: HashMap<FileId, Vec<DeletionRange>>,
)
pub fn set_deletion_ranges_map( &mut self, map: HashMap<FileId, Vec<DeletionRange>>, )
Sets the deletion ranges map, replacing the existing one.
Sourcepub fn with_deletion_ranges_map(
self,
map: HashMap<FileId, Vec<DeletionRange>>,
) -> Self
pub fn with_deletion_ranges_map( self, map: HashMap<FileId, Vec<DeletionRange>>, ) -> Self
Returns a new instance with the deletion ranges map replaced.
Sourcepub fn add_deletion_ranges_entry(
&mut self,
source: FileId,
ranges: Vec<DeletionRange>,
) -> Option<Vec<DeletionRange>>
pub fn add_deletion_ranges_entry( &mut self, source: FileId, ranges: Vec<DeletionRange>, ) -> Option<Vec<DeletionRange>>
Adds or replaces the deletion ranges for a specific source file. Returns previous ranges if any.
Sourcepub fn with_added_deletion_ranges_entry(
self,
file: FileId,
ranges: Vec<DeletionRange>,
) -> Self
pub fn with_added_deletion_ranges_entry( self, file: FileId, ranges: Vec<DeletionRange>, ) -> Self
Returns a new instance with the deletion ranges for the source file added or updated.
Sourcepub fn add_deletion_ranges_for_source(
&mut self,
file: FileId,
ranges: impl IntoIterator<Item = (usize, usize)>,
)
pub fn add_deletion_ranges_for_source( &mut self, file: FileId, ranges: impl IntoIterator<Item = (usize, usize)>, )
Extends the deletion ranges for a specific source file.
Sourcepub fn with_added_deletion_ranges_for_source(
self,
file: FileId,
ranges: impl IntoIterator<Item = (usize, usize)>,
) -> Self
pub fn with_added_deletion_ranges_for_source( self, file: FileId, ranges: impl IntoIterator<Item = (usize, usize)>, ) -> Self
Returns a new instance with the deletion ranges for the source file extended.
Sourcepub fn unset_deletion_ranges_map(&mut self)
pub fn unset_deletion_ranges_map(&mut self)
Clears the deletion ranges map.
Sourcepub fn without_deletion_ranges_map(self) -> Self
pub fn without_deletion_ranges_map(self) -> Self
Returns a new instance with an empty deletion ranges map.
Trait Implementations§
Source§impl Clone for CodebaseDiff
impl Clone for CodebaseDiff
Source§fn clone(&self) -> CodebaseDiff
fn clone(&self) -> CodebaseDiff
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodebaseDiff
impl Debug for CodebaseDiff
Source§impl Default for CodebaseDiff
impl Default for CodebaseDiff
Source§fn default() -> CodebaseDiff
fn default() -> CodebaseDiff
Source§impl<'de> Deserialize<'de> for CodebaseDiff
impl<'de> Deserialize<'de> for CodebaseDiff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CodebaseDiff
impl PartialEq for CodebaseDiff
Source§impl Serialize for CodebaseDiff
impl Serialize for CodebaseDiff
impl StructuralPartialEq for CodebaseDiff
Auto Trait Implementations§
impl Freeze for CodebaseDiff
impl RefUnwindSafe for CodebaseDiff
impl Send for CodebaseDiff
impl Sync for CodebaseDiff
impl Unpin for CodebaseDiff
impl UnwindSafe for CodebaseDiff
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);