Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
45e1f3ce6f |
2 changed files with 12 additions and 2 deletions
8
README.md
Normal file
8
README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# otvec
|
||||||
|
|
||||||
|
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
Otvec is a operational transformation library for lists in Rust.
|
||||||
|
|
||||||
|
It allows you to create distributed applications where lists can be edited without being connected to the
|
||||||
|
server.
|
|
@ -1,3 +1,6 @@
|
||||||
|
#![doc = include_str!("../README.md")]
|
||||||
|
#![warn(clippy::todo)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Debug, Display},
|
fmt::{Debug, Display},
|
||||||
ops::Range,
|
ops::Range,
|
||||||
|
@ -182,6 +185,7 @@ impl<T> Operation<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the 3-character operation name (NOP, INS, DEL, MOV, SEQ)
|
||||||
fn opname(&self) -> &'static str {
|
fn opname(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Operation::Nop => "NOP",
|
Operation::Nop => "NOP",
|
||||||
|
@ -648,7 +652,6 @@ fn transform_mov<T1, T2>(a: &mut Operation<T1>, b: &mut Operation<T2>, first: bo
|
||||||
|
|
||||||
if !m_to_right {
|
if !m_to_right {
|
||||||
// MOV to left
|
// MOV to left
|
||||||
// todo!("GreaterOverlap => left");
|
|
||||||
let del_ops = vec![
|
let del_ops = vec![
|
||||||
// Delete rest
|
// Delete rest
|
||||||
Operation::Del {
|
Operation::Del {
|
||||||
|
@ -755,7 +758,6 @@ fn transform_mov<T1, T2>(a: &mut Operation<T1>, b: &mut Operation<T2>, first: bo
|
||||||
n: m2_n,
|
n: m2_n,
|
||||||
to: m2_to,
|
to: m2_to,
|
||||||
} => {
|
} => {
|
||||||
// todo!("MOV-MOV");
|
|
||||||
let m2_to_right = m2_to > m2_pos;
|
let m2_to_right = m2_to > m2_pos;
|
||||||
let m2_to_start = if m2_to_right { *m2_to - *m2_n } else { *m2_to };
|
let m2_to_start = if m2_to_right { *m2_to - *m2_n } else { *m2_to };
|
||||||
let rtarget2 = m2_to_start..(m2_to_start + *m2_n);
|
let rtarget2 = m2_to_start..(m2_to_start + *m2_n);
|
||||||
|
|
Loading…
Reference in a new issue