From fdaf81371c0f6922bbfdc944432d66fb175071ad Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 24 Jan 2021 08:48:51 +0100 Subject: [PATCH] Small documentation updates on text --- src/lib.rs | 2 +- src/text.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e2d0623..ec4c145 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ //! interface over different types of diffing algorithms. It's based on the //! the diff algorithm implementations of [pijul](https://pijul.org/). //! -//! The crate is split into two levels: +//! The crate is split into two modules: //! //! * [`algorithms`]: This implements the different types of diffing algorithms. //! It provides both low level access to the algorithms with the minimal diff --git a/src/text.rs b/src/text.rs index 046b985..651c787 100644 --- a/src/text.rs +++ b/src/text.rs @@ -34,6 +34,19 @@ //! } //! } //! ``` +//! +//! ## Ops vs Changes +//! +//! Because very commonly two compared sequences will largely match this module +//! splits it's functionality into two layers. The first is inherited from the +//! general [`algorithms`](crate::algorithms) module: changes are encoded as +//! [diff operations](crate::algorithms::DiffOp). These are ranges of the +//! differences by index in the source sequence. Because this can be cumbersome +//! to work with a separate method [`TextDiff::iter_changes`] is provided which +//! expands all the changes on an item by item level encoded in an operation. +//! +//! Because the [`TextDiff::grouped_ops`] method can isolate clusters of changes +//! this even works for very long files if paired with this method. use std::borrow::Cow; use std::fmt; use std::io;