mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 21:07:43 +00:00
chore: cargo fix
This commit is contained in:
parent
3c7e939020
commit
8616f4d3b0
10 changed files with 26 additions and 30 deletions
|
@ -26,9 +26,9 @@ pub fn main() {
|
|||
#[cfg(feature = "mem-prof")]
|
||||
let profiler = dhat::Profiler::builder().trim_backtraces(None).build();
|
||||
let mut loro = LoroCore::default();
|
||||
let mut text = loro.get_or_create_root_text("text");
|
||||
let text = loro.get_or_create_root_text("text");
|
||||
let mut text_lock = text.lock().unwrap();
|
||||
let mut text = text_lock.as_text_mut().unwrap();
|
||||
let text = text_lock.as_text_mut().unwrap();
|
||||
for _i in 0..1 {
|
||||
for txn in txns.unwrap().as_array().unwrap() {
|
||||
let patches = txn
|
||||
|
|
|
@ -7,7 +7,7 @@ use enum_as_inner::EnumAsInner;
|
|||
use fxhash::FxHashMap;
|
||||
use owning_ref::{OwningRef, OwningRefMut};
|
||||
|
||||
use crate::{log_store::LogStoreWeakRef, op::RemoteOp, span::IdSpan, LogStore, LoroError};
|
||||
use crate::{log_store::LogStoreWeakRef, op::RemoteOp, span::IdSpan, LogStore};
|
||||
|
||||
use super::{
|
||||
map::MapContainer, text::text_container::TextContainer, Container, ContainerID, ContainerType,
|
||||
|
|
|
@ -18,7 +18,7 @@ fn basic() {
|
|||
let _weak = Arc::downgrade(&loro.log_store);
|
||||
let get_or_create_root_map = loro.get_or_create_root_map("map");
|
||||
let mut container_instance = get_or_create_root_map.lock().unwrap();
|
||||
let mut container = container_instance.as_map_mut().unwrap();
|
||||
let container = container_instance.as_map_mut().unwrap();
|
||||
container.insert("haha".into(), InsertValue::Int32(1));
|
||||
let ans = fx_map!(
|
||||
"haha".into() => LoroValue::I32(1)
|
||||
|
@ -42,7 +42,7 @@ mod map_proptest {
|
|||
let _weak = Arc::downgrade(&loro.log_store);
|
||||
let a = loro.get_or_create_root_map("map");
|
||||
let mut a = a.lock().unwrap();
|
||||
let mut container = a.as_map_mut().unwrap();
|
||||
let container = a.as_map_mut().unwrap();
|
||||
let mut map: HashMap<String, InsertValue> = HashMap::new();
|
||||
for (k, v) in key.iter().zip(value.iter()) {
|
||||
map.insert(k.clone(), v.clone());
|
||||
|
|
|
@ -13,7 +13,6 @@ use crate::{
|
|||
id::{Counter, ID},
|
||||
log_store::LogStoreWeakRef,
|
||||
op::{Content, Op, OpContent, RemoteOp},
|
||||
smstring::SmString,
|
||||
span::{HasCounterSpan, HasIdSpan, IdSpan},
|
||||
value::LoroValue,
|
||||
LogStore, VersionVector,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use rle::{
|
||||
rle_tree::{BumpMode, Position, SafeCursor, SafeCursorMut},
|
||||
rle_tree::{Position, SafeCursor, SafeCursorMut},
|
||||
HasLength, RleTree, RleVecWithLen,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused)]
|
||||
use crdt_list::{
|
||||
crdt::{ListCrdt, OpSet},
|
||||
yata::Yata,
|
||||
|
@ -204,6 +205,7 @@ pub mod fuzz {
|
|||
use crdt_list::test::{Action, TestFramework};
|
||||
use rle::{RleVecWithIndex, RleVecWithLen};
|
||||
use tabled::TableIteratorExt;
|
||||
use Action::*;
|
||||
|
||||
use crate::{
|
||||
container::text::{
|
||||
|
@ -329,7 +331,6 @@ pub mod fuzz {
|
|||
}
|
||||
}
|
||||
|
||||
use Action::*;
|
||||
#[test]
|
||||
fn issue_set_range() {
|
||||
crdt_list::test::test_with_actions::<YataImpl>(
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
mod iter;
|
||||
use std::{
|
||||
marker::PhantomPinned,
|
||||
ops::Range,
|
||||
sync::{Arc, RwLock, Weak},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
use std::sync::{Arc, Mutex, MutexGuard, RwLock};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
|
||||
|
||||
use owning_ref::{OwningRef, OwningRefMut};
|
||||
|
||||
use crate::{
|
||||
change::Change,
|
||||
configure::Configure,
|
||||
container::{
|
||||
manager::{ContainerInstance, ContainerManager, ContainerRef, ContainerRefMut},
|
||||
map::MapContainer,
|
||||
text::text_container::TextContainer,
|
||||
manager::{ContainerInstance, ContainerManager},
|
||||
ContainerID, ContainerType,
|
||||
},
|
||||
id::ClientID,
|
||||
op::RemoteOp,
|
||||
LogStore, LoroError, VersionVector,
|
||||
LogStore, VersionVector,
|
||||
};
|
||||
|
||||
pub struct LoroCore {
|
||||
|
@ -69,7 +67,7 @@ impl LoroCore {
|
|||
#[inline(always)]
|
||||
pub fn get_container(&self, id: &ContainerID) -> Option<Arc<Mutex<ContainerInstance>>> {
|
||||
let container = self.container.read().unwrap();
|
||||
container.get(id).map(|x| x.clone())
|
||||
container.get(id).cloned()
|
||||
}
|
||||
|
||||
pub fn export(&self, remote_vv: VersionVector) -> Vec<Change<RemoteOp>> {
|
||||
|
|
|
@ -6,7 +6,6 @@ use std::{
|
|||
use loro_core::{
|
||||
container::{
|
||||
manager::LockContainer,
|
||||
text::text_container::{self, TextContainer},
|
||||
Container, ContainerID,
|
||||
},
|
||||
InsertValue, LoroCore,
|
||||
|
@ -65,7 +64,7 @@ impl Loro {
|
|||
impl Map {
|
||||
pub fn set(&mut self, key: String, value: JsValue) {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let loro = loro.borrow_mut();
|
||||
let get_map_container_mut = loro.get_container(&self.id).unwrap();
|
||||
let mut map = get_map_container_mut.lock_map();
|
||||
map.insert(key.into(), InsertValue::try_from_js(value).unwrap())
|
||||
|
@ -73,18 +72,18 @@ impl Map {
|
|||
|
||||
pub fn delete(&mut self, key: String) {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let mut map = loro.get_container(&self.id).unwrap();
|
||||
let loro = loro.borrow_mut();
|
||||
let map = loro.get_container(&self.id).unwrap();
|
||||
let mut map = map.lock_map();
|
||||
map.delete(key.into())
|
||||
}
|
||||
|
||||
pub fn get_value(&mut self) -> JsValue {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let mut map = loro.get_container(&self.id).unwrap();
|
||||
let mut map = map.lock_map();
|
||||
map.get_value().clone().into()
|
||||
let loro = loro.borrow_mut();
|
||||
let map = loro.get_container(&self.id).unwrap();
|
||||
let map = map.lock_map();
|
||||
map.get_value().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,15 +91,15 @@ impl Map {
|
|||
impl Text {
|
||||
pub fn insert(&mut self, index: usize, text: &str) {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let mut text_container = loro.get_container(&self.id).unwrap();
|
||||
let loro = loro.borrow_mut();
|
||||
let text_container = loro.get_container(&self.id).unwrap();
|
||||
let mut text_container = text_container.lock_text();
|
||||
text_container.insert(index, text);
|
||||
}
|
||||
|
||||
pub fn delete(&mut self, index: usize, len: usize) {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let loro = loro.borrow_mut();
|
||||
let get_container = loro.get_container(&self.id).unwrap();
|
||||
let mut text_container = get_container.lock_text();
|
||||
text_container.delete(index, len);
|
||||
|
@ -108,9 +107,9 @@ impl Text {
|
|||
|
||||
pub fn get_value(&mut self) -> String {
|
||||
let loro = self.loro.upgrade().unwrap();
|
||||
let mut loro = loro.borrow_mut();
|
||||
let loro = loro.borrow_mut();
|
||||
let get_container = loro.get_container(&self.id).unwrap();
|
||||
let mut text_container = get_container.lock_text();
|
||||
let text_container = get_container.lock_text();
|
||||
text_container.get_value().as_string().unwrap().to_string()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{fmt::Debug, ops::Deref};
|
||||
|
||||
use bumpalo::Bump;
|
||||
|
||||
use num::{traits::AsPrimitive, FromPrimitive, Integer};
|
||||
|
||||
use crate::{rle_trait::HasIndex, HasLength, Rle};
|
||||
|
|
Loading…
Reference in a new issue