mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-19 05:00:36 +00:00
47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# difference.rs [](https://travis-ci.org/johannhof/difference.rs) [](https://ci.appveyor.com/project/johannhof/liquid-rust/branch/master) [](https://coveralls.io/github/johannhof/difference.rs?branch=master) [](https://crates.io/crates/difference)
|
|
A Rust text diffing library with built-in diffing assertion.
|
|
|
|
__[Documentation](https://johannhof.github.io/difference.rs)__
|
|
|
|
__[Examples](/Examples.md)__
|
|
|
|
```rust
|
|
use difference::Changeset;
|
|
|
|
let changeset = Changeset::new("test", "tent", "");
|
|
|
|
assert_eq!(changeset.diffs, vec![
|
|
Difference::Same("te".to_string()),
|
|
Difference::Rem("s".to_string()),
|
|
Difference::Add("n".to_string()),
|
|
Difference::Same("t".to_string())
|
|
]);
|
|
```
|
|
|
|

|
|

|
|
|
|
Usage
|
|
----------
|
|
|
|
Add the following to your Cargo.toml:
|
|
|
|
```toml
|
|
[dependencies]
|
|
difference = "2.0"
|
|
```
|
|
|
|
Now you can use the crate in your code
|
|
```rust
|
|
extern crate difference;
|
|
```
|
|
|
|
Using the binary
|
|
-----------------
|
|
|
|
difference can also be used as a command-line application. The best way to install it is using:
|
|
|
|
```sh
|
|
$ cargo install --features=bin
|
|
```
|