feat: rename similar -> likewise
This commit is contained in:
parent
a169e29954
commit
7e86fb2e55
44 changed files with 64 additions and 391 deletions
|
|
@ -93,7 +93,7 @@ impl TextDiffConfig {
|
|||
/// influence the behavior of unified diff generation.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let diff = TextDiff::configure().diff_lines("a\nb\nc", "a\nb\nC");
|
||||
/// let changes: Vec<_> = diff
|
||||
|
|
@ -131,7 +131,7 @@ impl TextDiffConfig {
|
|||
/// which lets you remap the diffs back to the original input strings.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let diff = TextDiff::configure().diff_words("foo bar baz", "foo BAR baz");
|
||||
/// let changes: Vec<_> = diff
|
||||
|
|
@ -169,7 +169,7 @@ impl TextDiffConfig {
|
|||
/// which lets you remap the diffs back to the original input strings.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let diff = TextDiff::configure().diff_chars("abcdef", "abcDDf");
|
||||
/// let changes: Vec<_> = diff
|
||||
|
|
@ -215,7 +215,7 @@ impl TextDiffConfig {
|
|||
/// which lets you remap the diffs back to the original input strings.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let diff = TextDiff::configure().diff_unicode_words("ah(be)ce", "ah(ah)ce");
|
||||
/// let changes: Vec<_> = diff
|
||||
|
|
@ -256,7 +256,7 @@ impl TextDiffConfig {
|
|||
/// which lets you remap the diffs back to the original input strings.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let diff = TextDiff::configure().diff_graphemes("💩🇦🇹🦠", "💩🇦🇱❄️");
|
||||
/// let changes: Vec<_> = diff
|
||||
|
|
@ -288,7 +288,7 @@ impl TextDiffConfig {
|
|||
/// Creates a diff of arbitrary slices.
|
||||
///
|
||||
/// ```rust
|
||||
/// use similar::{TextDiff, ChangeTag};
|
||||
/// use likewise::{TextDiff, ChangeTag};
|
||||
///
|
||||
/// let old = &["foo", "bar", "baz"];
|
||||
/// let new = &["foo", "BAR", "baz"];
|
||||
|
|
@ -469,7 +469,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n
|
|||
/// ratio of `0.0` would indicate completely distinct sequences.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use similar::TextDiff;
|
||||
/// # use likewise::TextDiff;
|
||||
/// let diff = TextDiff::from_chars("abcd", "bcde");
|
||||
/// assert_eq!(diff.ratio(), 0.75);
|
||||
/// ```
|
||||
|
|
@ -575,7 +575,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n
|
|||
/// to be considered similar. See [`TextDiff::ratio`] for more information.
|
||||
///
|
||||
/// ```
|
||||
/// # use similar::get_close_matches;
|
||||
/// # use likewise::get_close_matches;
|
||||
/// let matches = get_close_matches(
|
||||
/// "appel",
|
||||
/// &["ape", "apple", "peach", "puppy"][..],
|
||||
|
|
|
|||
|
|
@ -9,4 +9,3 @@ expression: "&diff.unified_diff().context_radius(3).header(\"old\", \"new\").to_
|
|||
-some stuff here
|
||||
+some amazing stuff here
|
||||
some more stuff here
|
||||
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
---
|
||||
source: src/text/inline.rs
|
||||
expression: "&changes"
|
||||
---
|
||||
[
|
||||
InlineChange {
|
||||
tag: Insert,
|
||||
old_index: None,
|
||||
new_index: Some(
|
||||
0,
|
||||
),
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"Stuff\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Equal,
|
||||
old_index: Some(
|
||||
0,
|
||||
),
|
||||
new_index: Some(
|
||||
1,
|
||||
),
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"Hello World\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Delete,
|
||||
old_index: Some(
|
||||
1,
|
||||
),
|
||||
new_index: None,
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"some ",
|
||||
),
|
||||
(
|
||||
false,
|
||||
"stuff here\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Insert,
|
||||
old_index: None,
|
||||
new_index: Some(
|
||||
2,
|
||||
),
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"some ",
|
||||
),
|
||||
(
|
||||
true,
|
||||
"amazing ",
|
||||
),
|
||||
(
|
||||
false,
|
||||
"stuff here\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Equal,
|
||||
old_index: Some(
|
||||
2,
|
||||
),
|
||||
new_index: Some(
|
||||
3,
|
||||
),
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"some more stuff here\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Delete,
|
||||
old_index: Some(
|
||||
3,
|
||||
),
|
||||
new_index: None,
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Delete,
|
||||
old_index: Some(
|
||||
4,
|
||||
),
|
||||
new_index: None,
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"Aha stuff here\n",
|
||||
),
|
||||
],
|
||||
},
|
||||
InlineChange {
|
||||
tag: Delete,
|
||||
old_index: Some(
|
||||
5,
|
||||
),
|
||||
new_index: None,
|
||||
values: [
|
||||
(
|
||||
false,
|
||||
"and more stuff",
|
||||
),
|
||||
],
|
||||
},
|
||||
]
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
---
|
||||
source: src/text/inline.rs
|
||||
expression: "&json"
|
||||
|
||||
---
|
||||
[
|
||||
{
|
||||
"tag": "insert",
|
||||
"old_index": null,
|
||||
"new_index": 0,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"Stuff\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "equal",
|
||||
"old_index": 0,
|
||||
"new_index": 1,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"Hello World\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 1,
|
||||
"new_index": null,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"some "
|
||||
],
|
||||
[
|
||||
false,
|
||||
"stuff here\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "insert",
|
||||
"old_index": null,
|
||||
"new_index": 2,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"some "
|
||||
],
|
||||
[
|
||||
true,
|
||||
"amazing "
|
||||
],
|
||||
[
|
||||
false,
|
||||
"stuff here\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "equal",
|
||||
"old_index": 2,
|
||||
"new_index": 3,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"some more stuff here\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 3,
|
||||
"new_index": null,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 4,
|
||||
"new_index": null,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"Aha stuff here\n"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 5,
|
||||
"new_index": null,
|
||||
"values": [
|
||||
[
|
||||
false,
|
||||
"and more stuff"
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
---
|
||||
source: src/text/mod.rs
|
||||
expression: "&json"
|
||||
|
||||
---
|
||||
[
|
||||
{
|
||||
"tag": "insert",
|
||||
"old_index": null,
|
||||
"new_index": 0,
|
||||
"value": "Stuff\n"
|
||||
},
|
||||
{
|
||||
"tag": "equal",
|
||||
"old_index": 0,
|
||||
"new_index": 1,
|
||||
"value": "Hello World\n"
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 1,
|
||||
"new_index": null,
|
||||
"value": "some stuff here\n"
|
||||
},
|
||||
{
|
||||
"tag": "insert",
|
||||
"old_index": null,
|
||||
"new_index": 2,
|
||||
"value": "some amazing stuff here\n"
|
||||
},
|
||||
{
|
||||
"tag": "equal",
|
||||
"old_index": 2,
|
||||
"new_index": 3,
|
||||
"value": "some more stuff here\n"
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 3,
|
||||
"new_index": null,
|
||||
"value": "\n"
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 4,
|
||||
"new_index": null,
|
||||
"value": "Aha stuff here\n"
|
||||
},
|
||||
{
|
||||
"tag": "delete",
|
||||
"old_index": 5,
|
||||
"new_index": null,
|
||||
"value": "and more stuff"
|
||||
}
|
||||
]
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
source: src/text/mod.rs
|
||||
expression: "&json"
|
||||
|
||||
---
|
||||
[
|
||||
{
|
||||
"op": "insert",
|
||||
"old_index": 0,
|
||||
"new_index": 0,
|
||||
"new_len": 1
|
||||
},
|
||||
{
|
||||
"op": "equal",
|
||||
"old_index": 0,
|
||||
"new_index": 1,
|
||||
"len": 1
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"old_index": 1,
|
||||
"old_len": 1,
|
||||
"new_index": 2,
|
||||
"new_len": 1
|
||||
},
|
||||
{
|
||||
"op": "equal",
|
||||
"old_index": 2,
|
||||
"new_index": 3,
|
||||
"len": 1
|
||||
},
|
||||
{
|
||||
"op": "delete",
|
||||
"old_index": 3,
|
||||
"old_len": 3,
|
||||
"new_index": 4
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue