Added example to readme

This commit is contained in:
Armin Ronacher 2021-01-24 02:28:37 +01:00
parent 6a1ba61b3a
commit 058924614a
2 changed files with 15 additions and 1 deletions

View file

@ -12,6 +12,20 @@ It provides both low level implementations of Myer's and the Patience diff
algorithm as well as high level text diffing utilities (such as the ability
to generate unified diffs).
```rust
use similar::algorithms::Algorithm;
use similar::text::unified_diff;
let unified_diff = unified_diff(
Algorithm::Patience,
old_text,
new_text,
3,
Some(("old.txt", "new.text"))
);
println!("{}", unified_diff);
```
## License and Links
- [Documentation](https://docs.rs/similar/)