java-diff-utils-rs 0.1.0-alpha.5

Experimental Rust port of the core diffing and patching behavior of java-diff-utils
Documentation
use serde::{Deserialize, Serialize};
use std::fmt;

/// Specifies the classification type of a sequence modification.
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum DeltaType {
    /// A block of data in the original sequence is replaced by another block of data.
    Change,
    /// A block of data in the original sequence is removed.
    Delete,
    /// A block of data is inserted into the sequence at a given position.
    Insert,
    /// Represents an unchanged block of data where original and revised content match.
    Equal,
}

impl fmt::Display for DeltaType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Change => write!(f, "CHANGE"),
            Self::Delete => write!(f, "DELETE"),
            Self::Insert => write!(f, "INSERT"),
            Self::Equal => write!(f, "EQUAL"),
        }
    }
}