From 45e1f3ce6f5f11cad6ccc84a3a911f31779cf7c0 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 16 Sep 2024 17:23:27 +0200 Subject: [PATCH] add readme --- README.md | 8 ++++++++ src/lib.rs | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..453cbf5 --- /dev/null +++ b/README.md @@ -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. diff --git a/src/lib.rs b/src/lib.rs index c8cc051..0341158 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +#![doc = include_str!("../README.md")] +#![warn(clippy::todo)] + use std::{ fmt::{Debug, Display}, ops::Range, @@ -182,6 +185,7 @@ impl Operation { } } + /// Return the 3-character operation name (NOP, INS, DEL, MOV, SEQ) fn opname(&self) -> &'static str { match self { Operation::Nop => "NOP", @@ -648,7 +652,6 @@ fn transform_mov(a: &mut Operation, b: &mut Operation, first: bo if !m_to_right { // MOV to left - // todo!("GreaterOverlap => left"); let del_ops = vec![ // Delete rest Operation::Del { @@ -755,7 +758,6 @@ fn transform_mov(a: &mut Operation, b: &mut Operation, first: bo n: m2_n, to: m2_to, } => { - // todo!("MOV-MOV"); let m2_to_right = m2_to > m2_pos; 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);