Skip to content

stdlib/diffView source ↗

diff

9 items · generated by scribe fromstdlib/diff.fd· synced 2026-11-15

stdlib/diff9 items

Contents

DiffOp

One edit-script line.

pub struct DiffOp {

Fields:

NameType
tagstr
textstr

Defined at line 19


diff_lines

Compute the edit script between old_text and new_text as Vec. Context lines are tagged ” ”, deletions ”-”, inserts ”+”.

pub fn diff_lines(old_text: str, new_text: str) -> Vec<DiffOp> {

Parameters:

  • old_text: str
  • new_text: str

Returns: Vec<DiffOp>

Defined at line 38


diff_vec

Edit script between two already-split line vecs.

pub fn diff_vec(a: Vec<str>, b: Vec<str>) -> Vec<DiffOp> {

Parameters:

  • a: Vec<str>
  • b: Vec<str>

Returns: Vec<DiffOp>

Defined at line 45


diff_is_empty

True when the texts are identical (no +/- ops).

pub fn diff_is_empty(ops: Vec<DiffOp>) -> bool {

Parameters:

  • ops: Vec<DiffOp>

Returns: bool

Defined at line 116


diff_change_count

Count of changed lines (additions + deletions).

pub fn diff_change_count(ops: Vec<DiffOp>) -> i64 {

Parameters:

  • ops: Vec<DiffOp>

Returns: i64

Defined at line 128


diff_format

Render ops as ” text” / “-text” / “+text” lines.

pub fn diff_format(ops: Vec<DiffOp>) -> str {

Parameters:

  • ops: Vec<DiffOp>

Returns: str

Defined at line 141


diff_unified

Unified-diff rendering with context lines around each hunk and --- old_label / ”+++ new_label” headers.

pub fn diff_unified(old_text: str, new_text: str, old_label: str, new_label: str, context: i64) -> str {

Parameters:

  • old_text: str
  • new_text: str
  • old_label: str
  • new_label: str
  • context: i64

Returns: str

Defined at line 154


Generated by scribe, the Fides documentation generator