hex-patch 1.12.5

HexPatch is a binary patcher and editor with terminal user interface (TUI), it's capable of disassembling instructions and assembling patches. It supports a variety of architectures and file formats. Also, it can edit remote files via SSH.
Documentation
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Change {
    offset: usize,
    old: Vec<u8>,
    new: Vec<u8>,
}

impl Change {
    pub fn new(offset: usize, old: &[u8], new: &[u8]) -> Self {
        if old.len() != new.len() {
            panic!("{}", t!("panic.data_length_mismatch"));
        }
        Self {
            offset,
            old: old.to_vec(),
            new: new.to_vec(),
        }
    }

    pub fn offset(&self) -> usize {
        self.offset
    }

    pub fn len(&self) -> usize {
        self.old.len()
    }

    pub fn is_empty(&self) -> bool {
        self.old.is_empty()
    }

    pub fn apply(&self, data: &mut Vec<u8>) {
        data.splice(
            self.offset..self.offset + self.old.len(),
            self.new.iter().cloned(),
        );
    }

    pub fn revert(&self, data: &mut Vec<u8>) {
        data.splice(
            self.offset..self.offset + self.new.len(),
            self.old.iter().cloned(),
        );
    }
}