mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix warnings
This commit is contained in:
@ -224,7 +224,7 @@ fn mk_acked_ws_message(revision: &Revision) -> WsMessageAdaptor {
|
||||
// let _ = wtr.write_i64::<BigEndian>(revision.rev_id);
|
||||
|
||||
let mut rev_id = RevId::new();
|
||||
rev_id.set_inner(revision.rev_id);
|
||||
rev_id.set_value(revision.rev_id);
|
||||
let data = rev_id.write_to_bytes().unwrap();
|
||||
|
||||
let data = WsDocumentData {
|
||||
|
@ -1,57 +0,0 @@
|
||||
use std::cmp::{max, min};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Interval {
|
||||
pub start: i64,
|
||||
pub end: i64,
|
||||
}
|
||||
|
||||
impl Interval {
|
||||
/// Construct a new `Interval` representing the range [start..end).
|
||||
/// It is an invariant that `start <= end`.
|
||||
pub fn new(start: i64, end: i64) -> Interval {
|
||||
debug_assert!(start <= end);
|
||||
Interval { start, end }
|
||||
}
|
||||
|
||||
pub fn start(&self) -> i64 { self.start }
|
||||
|
||||
pub fn end(&self) -> i64 { self.end }
|
||||
|
||||
pub fn is_before(&self, val: i64) -> bool { self.end <= val }
|
||||
|
||||
pub fn contains(&self, val: i64) -> bool { self.start <= val && val < self.end }
|
||||
|
||||
pub fn contains_range(&self, start: i64, end: i64) -> bool { !self.intersect(Interval::new(start, end)).is_empty() }
|
||||
|
||||
pub fn is_after(&self, val: i64) -> bool { self.start > val }
|
||||
|
||||
pub fn is_empty(&self) -> bool { self.end <= self.start }
|
||||
|
||||
pub fn intersect(&self, other: Interval) -> Interval {
|
||||
let start = max(self.start, other.start);
|
||||
let end = min(self.end, other.end);
|
||||
Interval {
|
||||
start,
|
||||
end: max(start, end),
|
||||
}
|
||||
}
|
||||
|
||||
// the first half of self - other
|
||||
pub fn prefix(&self, other: Interval) -> Interval {
|
||||
Interval {
|
||||
start: min(self.start, other.start),
|
||||
end: min(self.end, other.start),
|
||||
}
|
||||
}
|
||||
|
||||
// the second half of self - other
|
||||
pub fn suffix(&self, other: Interval) -> Interval {
|
||||
Interval {
|
||||
start: max(self.start, other.end),
|
||||
end: max(self.end, other.end),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn size(&self) -> i64 { self.end - self.start }
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
mod edit_actor;
|
||||
mod edit_doc;
|
||||
mod interval;
|
||||
mod open_handle;
|
||||
|
||||
pub use edit_actor::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::document::helper::{DocScript, DocumentTest};
|
||||
use flowy_document::services::doc::{Document, FlowyDoc};
|
||||
use flowy_ot::core::Delta;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn sync_doc_insert_text() {
|
||||
|
@ -14,7 +14,7 @@ use flowy_user::services::user::UserSession;
|
||||
// use crate::helper::*;
|
||||
use crate::helper::{spawn_server, TestServer};
|
||||
use flowy_document::protobuf::UpdateDocParams;
|
||||
use flowy_ot::core::Delta;
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use serde::__private::Formatter;
|
||||
|
||||
|
Reference in New Issue
Block a user