mitsuhiko/similar — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small Rust crate for doing diffs between two inputs in a really usable way. I want it to handle normal text well, including comparing by lines, words, characters, and graphemes, and it would be great if it can also diff raw bytes and even generic comparable sequences. Please include a few diff strategies so people can choose between them when needed, plus a simple high level API for the common case where someone just wants to compare two strings and iterate over inserts, deletes, and unchanged parts.

I also want it to generate unified diff output and have nice terminal friendly formatting for examples. Keep it dependency free if possible. If it makes sense, support no std with alloc too.

Please add clear docs, a couple of examples, and tests so it feels like a real reusable library someone could publish and use in snapshot testing or similar workflows. You can look up current Rust docs online if you need to.

Want more depth? Deep Reverse