1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Codec-aware diff, patch, invert, commute, and merge behavior.
//!
//! Claw VCS uses codecs so different content types can have appropriate merge
//! semantics. Built-in codecs cover line-oriented text, structural JSON, and
//! binary replacement.
//!
//! # Example
//!
//! ```rust
//! use claw_patch::text_line::TextLineCodec;
//! use claw_patch::Codec;
//!
//! let codec = TextLineCodec;
//! let old = b"first\nsecond\nthird\n";
//! let new = b"first\nchanged\nthird\n";
//!
//! let ops = codec.diff(old, new)?;
//! let applied = codec.apply(old, &ops)?;
//!
//! assert_eq!(applied, new);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
/// Binary replacement codec.
/// Codec trait shared by all patch implementations.
/// Patch codec errors.
/// Structural JSON diff and merge codec.
/// Codec registry and path-to-codec lookup.
/// Line-oriented text diff and merge codec.
/// Patch codec behavior.
pub use Codec;
/// Patch codec error.
pub use PatchError;
/// Registry for locating codecs by id or path.
pub use CodecRegistry;