bit_diff_core

Low-level diff algorithm (gix-diff equivalent)

git
diff
moon add mizchi/bit_diff_core@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
497
README

#
DiffEditOp

pub(all) enum DiffEditOp {
Keep(Int, Int)
Delete(Int)
Insert(Int)
}

#
count_lines

fn count_lines(data : Bytes) -> Int

Count lines in byte content.

#
format_range

fn format_range(start : Int, count : Int) -> String

Format a unified diff hunk range (e.g., "1,3" or "5").

#
myers_diff

fn myers_diff(old : Array[String], new : Array[String]) -> Array[DiffEditOp]

Myers diff algorithm. Computes the shortest edit script between two arrays of lines.

#
split_lines

fn split_lines(data : Bytes) -> Array[String]

Split bytes into lines, removing trailing empty line if content ends with newline.

#
unified_hunks

fn unified_hunks(out : Array[String], old_content : Bytes?, new_content : Bytes?, context_lines? : Int) -> Unit

Generate unified diff hunks from old and new content bytes.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io