Skip to main content

FragMap

Struct FragMap 

Source
pub struct FragMap {
    pub commits: Vec<String>,
    pub clusters: Vec<SpanCluster>,
    pub matrix: Vec<Vec<TouchKind>>,
}
Expand description

The complete fragmap: commits, span clusters, and the matrix showing which commits touch which clusters.

The matrix is commits × clusters, where matrix[commit_idx][cluster_idx] indicates how that commit touches that cluster.

Fields§

§commits: Vec<String>

The commits in order (oldest to newest).

§clusters: Vec<SpanCluster>

The span clusters (code regions touched by commits).

§matrix: Vec<Vec<TouchKind>>

Matrix[commit_idx][cluster_idx] = TouchKind

Implementations§

Source§

impl FragMap

Source

pub fn squash_target(&self, commit_idx: usize) -> Option<usize>

Find the single commit this commit can be squashed into, if any.

Returns Some(target_idx) when every cluster the commit touches is squashable (no conflicting commits in between) and all clusters point to the same single earlier commit. Returns None otherwise.

Source

pub fn is_fully_squashable(&self, commit_idx: usize) -> bool

Check if a commit is fully squashable into a single other commit.

Source

pub fn shares_cluster_with(&self, a: usize, b: usize) -> bool

Check whether two commits both touch at least one common cluster.

Source

pub fn pairwise_squash_relation(&self, a: usize, b: usize) -> SquashRelation

Determine the overall squash relationship between two commits.

Examines every cluster both commits touch:

  • NoRelation if they share no clusters at all.
  • Squashable if every shared cluster is squashable (no interfering commits in between).
  • Conflicting if any shared cluster has interfering commits.
Source

pub fn cluster_relation( &self, earlier_commit_idx: usize, later_commit_idx: usize, cluster_idx: usize, ) -> SquashRelation

Determine the relationship between two commits for a specific cluster.

Returns NoRelation if one or both commits don’t touch the cluster, Squashable if both touch it with no collisions in between, or Conflicting if both touch it with other commits in between.

Source

pub fn connector_squashable( &self, commit_idx: usize, cluster_idx: usize, scope: SquashableScope, ) -> Option<bool>

Determine whether a connector between below_idx and its earliest earlier neighbour in cluster_idx should be rendered as squashable.

Returns None if there is no connector (no touch above or no below). Returns Some(true) for squashable, Some(false) for conflicting.

scope controls the rule used:

  • Cluster: per-cluster pair only (fine-grained).
  • Commit: the entire lower commit must be fully squashable into the same single upper commit (strict, matching the original fragmap tool).

Trait Implementations§

Source§

impl Clone for FragMap

Source§

fn clone(&self) -> FragMap

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FragMap

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.