TriMatching

Struct TriMatching 

Source
pub struct TriMatching { /* private fields */ }
Expand description

Matching between a base and two branch trees.

This struct coordinates the matching process for 3-way merge:

  1. Matches the right branch against the base tree
  2. Swaps left/right matchings in base nodes (so right matchings become “right”)
  3. Matches the left branch against the base tree
  4. Sets up partner relationships so each branch node knows its partners in the other branch

Implementations§

Source§

impl TriMatching

Source

pub fn new(left: NodeRef, base: NodeRef, right: NodeRef) -> Self

Creates a new TriMatching using the default HeuristicMatching algorithm.

Source

pub fn with_copy_threshold( left: NodeRef, base: NodeRef, right: NodeRef, copy_threshold: i32, ) -> Self

Creates a new TriMatching with a custom copy threshold.

The copy threshold determines the minimum size (in info bytes) for a subtree to be considered a copy. Smaller subtrees are treated as separate insertions. Use 0 to disable copy detection.

Source

pub fn with_matching<L: Matching + Default, R: Matching + Default>( left: NodeRef, base: NodeRef, right: NodeRef, ) -> Self

Creates a new TriMatching with custom matching algorithms.

This allows using different matching strategies for left and right branches. For example, DiffMatching could be used for one branch if needed.

Source

pub fn left_root(&self) -> &NodeRef

Returns a reference to the left branch root.

Source

pub fn right_root(&self) -> &NodeRef

Returns a reference to the right branch root.

Source

pub fn base_root(&self) -> &NodeRef

Returns a reference to the base tree root.

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, 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> Same for T

Source§

type Output = T

Should always be Self
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.