Skip to main content

AdvancedReuseAnalyzer

Struct AdvancedReuseAnalyzer 

Source
pub struct AdvancedReuseAnalyzer {
    pub analysis_stats: ReuseAnalysisStats,
    /* private fields */
}
Expand description

Advanced node reuse analyzer with sophisticated matching algorithms

Fields§

§analysis_stats: ReuseAnalysisStats

Statistics for reuse analysis

Implementations§

Source§

impl AdvancedReuseAnalyzer

Source

pub fn new() -> Self

Create a new reuse analyzer with default configuration

Source

pub fn with_config(_config: ReuseConfig) -> Self

Create analyzer with custom configuration

Source

pub fn analyze_reuse_opportunities( &mut self, old_tree: &Node, new_tree: &Node, edits: &EditSet, config: &ReuseConfig, ) -> ReuseAnalysisResult

Analyze potential node reuse between old and new trees

Returns a mapping of old node positions to reuse strategies, enabling intelligent tree reconstruction with maximum node reuse.

Source

pub fn map_old_position_to_new(&self, old_pos: usize, edits: &EditSet) -> usize

Map an old-tree byte position to its corresponding position in the new tree, using the supplied EditSet to apply byte shifts.

Semantics:

  • If old_pos precedes the first edit’s start_byte, returns old_pos unchanged.
  • If old_pos falls inside an edit’s old range [start_byte, old_end_byte), returns that edit’s new_end_byte (i.e. the position is consumed by the edit and snaps to the edit’s new boundary).
  • Otherwise the position is shifted by the cumulative byte shift of all prior edits whose old_end_byte <= old_pos.

Edits in EditSet are sorted by start_byte, so iteration short- circuits as soon as the next edit starts past old_pos.

Source

pub fn try_register_match( &self, reuse_map: &mut HashMap<usize, ReuseStrategy>, old_pos: usize, new_pos: usize, reuse_type: ReuseType, confidence: f64, ) -> bool

Attempt to register an old_pos -> new_pos reuse claim, enforcing the one-to-one invariant: at most one old position may map to any given new position.

Returns true if the registration was inserted, false if some other old_pos has already claimed the same new_pos (in which case the existing claim is left unchanged).

Trait Implementations§

Source§

impl Debug for AdvancedReuseAnalyzer

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AdvancedReuseAnalyzer

Source§

fn default() -> Self

Returns the “default value” for a type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more