chore: rustfmt, clippy lints and code tidying
This commit is contained in:
1 parent
3716c3e698
commit
1752753fcc
19 files changed
+1273
-738
No files matched your search
+8
-6
@@ -33,19 +33,21 @@ pub struct MemoryState {
|
||||
impl MemoryState {
|
||||
pub fn unique_items<T: Eq + std::hash::Hash + Clone>(input: Vec<T>) -> Vec<T> {
|
||||
let mut keys = std::collections::HashSet::new();
|
||||
input.into_iter().filter(|entry| keys.insert(entry.clone())).collect()
|
||||
input
|
||||
.into_iter()
|
||||
.filter(|entry| keys.insert(entry.clone()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn broadcast_activity(&self, message: &str) {
|
||||
let payload = serde_json::json!({
|
||||
"type": "activity",
|
||||
"data": message
|
||||
}).to_string();
|
||||
})
|
||||
.to_string();
|
||||
let _ = self.activity_tx.send(payload);
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn get_full_graph(&self) -> KnowledgeGraph {
|
||||
self.graph.read()
|
||||
}
|
||||
@@ -61,10 +63,10 @@ impl MemoryState {
|
||||
pub fn rebuild_index(&self) {
|
||||
if let Ok(new_idx) = MemoryIndex::new(&self.base_dir) {
|
||||
let graph = self.graph.read();
|
||||
for (_, e) in &graph.entities {
|
||||
for e in graph.entities.values() {
|
||||
let _ = new_idx.index_entity(e);
|
||||
}
|
||||
|
||||
|
||||
let tasks = self.tasks.read();
|
||||
for t in tasks {
|
||||
let _ = new_idx.index_task(&t);
|
||||
|
||||
Reference in new issue
Block a user