diff_match_patch_rs::traits

Trait DType

Source
pub trait DType:
    Copy
    + Ord
    + Eq
    + Hash {
    // Required methods
    fn bisect_split(
        dmp: &DiffMatchPatch,
        old: &[Self],
        new: &[Self],
        x: usize,
        y: usize,
        deadline: Option<Instant>,
    ) -> Result<Vec<Diff<Self>>, Error>;
    fn from_char(c: char) -> Self;
    fn as_char(&self) -> Option<char>;
    fn from_str(str: &str) -> Vec<Self>;
    fn to_string(data: &[Self]) -> Result<String, Error>;
    fn is_linebreak_end(input: &[Self]) -> bool;
    fn is_linebreak_start(input: &[Self]) -> bool;
    fn percent_encode(input: &[Self]) -> Vec<Self>;
    fn percent_decode(input: &[Self]) -> Vec<Self>;

    // Provided method
    fn humanize(_diffs: &mut Vec<Diff<Self>>) -> Result<(), Error> { ... }
}

Required Methods§

Source

fn bisect_split( dmp: &DiffMatchPatch, old: &[Self], new: &[Self], x: usize, y: usize, deadline: Option<Instant>, ) -> Result<Vec<Diff<Self>>, Error>

Source

fn from_char(c: char) -> Self

Source

fn as_char(&self) -> Option<char>

Source

fn from_str(str: &str) -> Vec<Self>

Source

fn to_string(data: &[Self]) -> Result<String, Error>

Source

fn is_linebreak_end(input: &[Self]) -> bool

Source

fn is_linebreak_start(input: &[Self]) -> bool

Source

fn percent_encode(input: &[Self]) -> Vec<Self>

Source

fn percent_decode(input: &[Self]) -> Vec<Self>

Provided Methods§

Source

fn humanize(_diffs: &mut Vec<Diff<Self>>) -> Result<(), Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DType for char

Source§

fn bisect_split( dmp: &DiffMatchPatch, old: &[char], new: &[char], x: usize, y: usize, deadline: Option<Instant>, ) -> Result<Vec<Diff<char>>, Error>

Source§

fn from_char(c: char) -> Self

Source§

fn as_char(&self) -> Option<char>

Source§

fn from_str(str: &str) -> Vec<Self>

Source§

fn to_string(data: &[Self]) -> Result<String, Error>

Source§

fn is_linebreak_end(input: &[Self]) -> bool

Source§

fn is_linebreak_start(input: &[Self]) -> bool

Source§

fn percent_encode(input: &[Self]) -> Vec<Self>

Source§

fn percent_decode(input: &[Self]) -> Vec<Self>

Source§

impl DType for u8

Source§

fn bisect_split( dmp: &DiffMatchPatch, old: &[u8], new: &[u8], x: usize, y: usize, deadline: Option<Instant>, ) -> Result<Vec<Diff<u8>>, Error>

Source§

fn from_char(c: char) -> Self

Source§

fn as_char(&self) -> Option<char>

Source§

fn from_str(str: &str) -> Vec<Self>

Source§

fn to_string(data: &[Self]) -> Result<String, Error>

Source§

fn is_linebreak_end(input: &[Self]) -> bool

Source§

fn is_linebreak_start(input: &[Self]) -> bool

Source§

fn percent_encode(input: &[Self]) -> Vec<Self>

Source§

fn percent_decode(input: &[Self]) -> Vec<Self>

Source§

fn humanize(diffs: &mut Vec<Diff<Self>>) -> Result<(), Error>

Source§

impl DType for usize

Source§

fn bisect_split( dmp: &DiffMatchPatch, old: &[usize], new: &[usize], x: usize, y: usize, deadline: Option<Instant>, ) -> Result<Vec<Diff<usize>>, Error>

Source§

fn from_char(c: char) -> Self

Source§

fn as_char(&self) -> Option<char>

Source§

fn from_str(_: &str) -> Vec<Self>

Source§

fn to_string(_: &[Self]) -> Result<String, Error>

Source§

fn is_linebreak_end(_: &[Self]) -> bool

Source§

fn is_linebreak_start(_: &[Self]) -> bool

Source§

fn percent_encode(_: &[Self]) -> Vec<Self>

Source§

fn percent_decode(_: &[Self]) -> Vec<Self>

Implementors§