my fork of dmp
bendn 8 days ago
parent 8d72753 · commit 07658f3
-rw-r--r--src/dmp.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/dmp.rs b/src/dmp.rs
index 3e9f0dc..e0220c5 100644
--- a/src/dmp.rs
+++ b/src/dmp.rs
@@ -27,7 +27,7 @@ pub enum Ops {
/// (Ops::Insert, String::new("Goodbye")) means add `Goodbye`
/// (Ops::Equal, String::new("World")) means keep world
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct Diff<T: DType>(pub(crate) Ops, pub(crate) Vec<T>);
+pub struct Diff<T: DType>(pub Ops, pub Vec<T>);
impl Display for Diff<u8> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -92,27 +92,27 @@ pub struct DiffMatchPatch {
/// a speedup flag, If present and false, then don't run
/// a line-level diff first to identify the changed areas.
/// Defaults to true, which does a faster, slightly less optimal diff.
- checklines: bool,
+ pub checklines: bool,
/// A default timeout in num milliseconda, defaults to 1000 (1 second)
- timeout: Option<u32>,
+ pub timeout: Option<u32>,
// Cost of an empty edit operation in terms of edit characters. Defaults to 4
- edit_cost: usize,
+ pub edit_cost: usize,
/// At what point is no match declared (0.0 = perfection, 1.0 = very loose).
- match_threshold: f32,
+ pub match_threshold: f32,
/// How far to search for a match (0 = exact location, 1000+ = broad match).
/// A match this many characters away from the expected location will add
/// 1.0 to the score (0.0 is a perfect match).
/// int Match_Distance;
- match_distance: usize,
+ pub match_distance: usize,
/// The number of bits in an int.
- match_max_bits: usize,
+ pub match_max_bits: usize,
/// When deleting a large block of text (over ~64 characters), how close does
/// the contents have to match the expected contents. (0.0 = perfection,
/// 1.0 = very loose). Note that `match_threshold` controls how closely the
/// end points of a delete need to match.
- delete_threshold: f32,
+ pub delete_threshold: f32,
/// Chunk size for context length.
- patch_margin: u8,
+ pub patch_margin: u8,
}
impl Default for DiffMatchPatch {
@@ -2320,11 +2320,11 @@ impl DiffMatchPatch {
// Patch Methods
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Patch<T: DType> {
- diffs: Vec<Diff<T>>,
- start1: usize,
- start2: usize,
- length1: usize,
- length2: usize,
+ pub diffs: Vec<Diff<T>>,
+ pub start1: usize,
+ pub start2: usize,
+ pub length1: usize,
+ pub length2: usize,
}
impl<T: DType> Default for Patch<T> {