mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-23 13:39:12 +00:00
chore: cargo fix
This commit is contained in:
parent
065e646a7e
commit
647352aa2a
5 changed files with 7 additions and 14 deletions
|
@ -156,7 +156,7 @@ mod run {
|
||||||
let buf = loro.encode(EncodeConfig::from_vv(None)).unwrap();
|
let buf = loro.encode(EncodeConfig::from_vv(None)).unwrap();
|
||||||
let mut store2 = LoroCore::default();
|
let mut store2 = LoroCore::default();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let _ = store2.decode(&buf).unwrap();
|
store2.decode(&buf).unwrap();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,8 +296,7 @@ impl ContainerRegistry {
|
||||||
self.insert(id.clone(), container);
|
self.insert(id.clone(), container);
|
||||||
}
|
}
|
||||||
|
|
||||||
let container = self.get(id).unwrap();
|
self.get(id).unwrap()
|
||||||
container
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_or_create_container_idx(&mut self, id: &ContainerID) -> ContainerIdx {
|
pub(crate) fn get_or_create_container_idx(&mut self, id: &ContainerID) -> ContainerIdx {
|
||||||
|
|
|
@ -311,7 +311,7 @@ pub(super) fn decode_snapshot(
|
||||||
let mut container_idx2type = FxHashMap::default();
|
let mut container_idx2type = FxHashMap::default();
|
||||||
|
|
||||||
for container_id in containers.iter() {
|
for container_id in containers.iter() {
|
||||||
let container_idx = store.reg.get_or_create_container_idx(&container_id);
|
let container_idx = store.reg.get_or_create_container_idx(container_id);
|
||||||
container_idx2type.insert(container_idx, container_id.container_type());
|
container_idx2type.insert(container_idx, container_id.container_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,7 @@ impl LoroCore {
|
||||||
pub fn get_list<I: Into<ContainerIdRaw>>(&mut self, id: I) -> List {
|
pub fn get_list<I: Into<ContainerIdRaw>>(&mut self, id: I) -> List {
|
||||||
let id: ContainerIdRaw = id.into();
|
let id: ContainerIdRaw = id.into();
|
||||||
let mut store = self.log_store.write().unwrap();
|
let mut store = self.log_store.write().unwrap();
|
||||||
let instance = store
|
let instance = store.get_or_create_container(&id.with_type(ContainerType::List));
|
||||||
.get_or_create_container(&id.with_type(ContainerType::List))
|
|
||||||
.clone();
|
|
||||||
let cid = store.this_client_id();
|
let cid = store.this_client_id();
|
||||||
List::from_instance(instance, cid)
|
List::from_instance(instance, cid)
|
||||||
}
|
}
|
||||||
|
@ -58,9 +56,7 @@ impl LoroCore {
|
||||||
pub fn get_map<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Map {
|
pub fn get_map<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Map {
|
||||||
let id: ContainerIdRaw = id.into();
|
let id: ContainerIdRaw = id.into();
|
||||||
let mut store = self.log_store.write().unwrap();
|
let mut store = self.log_store.write().unwrap();
|
||||||
let instance = store
|
let instance = store.get_or_create_container(&id.with_type(ContainerType::Map));
|
||||||
.get_or_create_container(&id.with_type(ContainerType::Map))
|
|
||||||
.clone();
|
|
||||||
let cid = store.this_client_id();
|
let cid = store.this_client_id();
|
||||||
Map::from_instance(instance, cid)
|
Map::from_instance(instance, cid)
|
||||||
}
|
}
|
||||||
|
@ -69,9 +65,7 @@ impl LoroCore {
|
||||||
pub fn get_text<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Text {
|
pub fn get_text<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Text {
|
||||||
let id: ContainerIdRaw = id.into();
|
let id: ContainerIdRaw = id.into();
|
||||||
let mut store = self.log_store.write().unwrap();
|
let mut store = self.log_store.write().unwrap();
|
||||||
let instance = store
|
let instance = store.get_or_create_container(&id.with_type(ContainerType::Text));
|
||||||
.get_or_create_container(&id.with_type(ContainerType::Text))
|
|
||||||
.clone();
|
|
||||||
let cid = store.this_client_id();
|
let cid = store.this_client_id();
|
||||||
Text::from_instance(instance, cid)
|
Text::from_instance(instance, cid)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
sync::{Arc, Mutex, Weak},
|
sync::{Mutex, Weak},
|
||||||
};
|
};
|
||||||
|
|
||||||
use loro_core::{
|
use loro_core::{
|
||||||
|
|
Loading…
Reference in a new issue