doc(inline/iter_strings_lossy): describe different behaviors (#52)

This commit is contained in:
WJH 2023-10-13 05:06:38 +08:00 committed by GitHub
parent 47f46257d4
commit 2b31f65445
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,6 +147,12 @@ impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T> {
///
/// Each item is a tuple in the form `(emphasized, value)` where `emphasized`
/// is true if it should be highlighted as an inline diff.
///
/// By default, words are split by whitespace, which results in coarser diff.
/// For example: `"f(x) y"` is tokenized as `["f(x)", "y"]`.
///
/// If you want it to be tokenized instead as `["f(", "x", ")"]`,
/// you should enable the `"unicode"` flag.
pub fn iter_strings_lossy(&self) -> impl Iterator<Item = (bool, Cow<'_, str>)> {
self.values()
.iter()