ketsugou

Crates.ioketsugou
lib.rsketsugou
version0.1.0
sourcesrc
created_at2022-04-07 09:13:49.116142
updated_at2022-04-07 09:13:49.116142
descriptionmerges two arrays
homepage
repositoryhttps://github.com/SoundRabbit/ketsugou
max_upload_size
id563556
size20,909
(SoundRabbit)

documentation

README

Ketsugou

Exmaples

use std::collections::VecDeque;
let kitten: VecDeque<_> = vec!['k', 'i', 't', 't', 'e', 'n'].into();
let sitting: VecDeque<_> = vec!['s', 'i', 't', 't', 'i', 'n', 'g'].into();

let expected: VecDeque<_> = vec![
    Merged::Replace('k', 's'),
    Merged::Keep('i', 'i'),
    Merged::Keep('t', 't'),
    Merged::Keep('t', 't'),
    Merged::Replace('e', 'i'),
    Merged::Keep('n', 'n'),
    Merged::Append('g'),
]
.into();
let merged = ketsugou::merge(
    kitten,
    sitting,
    |x, y| *x == *y,
    ketsugou::constant_cost2(1.0),
    ketsugou::constant_cost1(1.0),
    ketsugou::constant_cost1(1.0),
);

assert_eq!(expected, merged);
Commit count: 7

cargo fmt