Skip to main content

Crate claw_patch

Crate claw_patch 

Source
Expand description

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

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);

Re-exports§

pub use codec::Codec;
pub use error::PatchError;
pub use registry::CodecRegistry;

Modules§

binary
Binary replacement codec.
codec
Codec trait shared by all patch implementations.
error
Patch codec errors.
json_tree
Structural JSON diff and merge codec.
registry
Codec registry and path-to-codec lookup.
text_line
Line-oriented text diff and merge codec.