MCPcopy Create free account
hub / github.com/bajrangCoder/setu / toggle_node_expanded

Method toggle_node_expanded

src/entities/collections.rs:491–514  ·  view source on GitHub ↗
(
        &mut self,
        collection_id: Uuid,
        node_id: Uuid,
        cx: &mut Context<Self>,
    )

Source from the content-addressed store, hash-verified

489 let previous = std::mem::take(&mut self.collections);
490 self.workspace_collections
491 .insert(self.active_workspace_id, previous);
492 self.active_workspace_id = workspace_id;
493 self.collections = self
494 .workspace_collections
495 .remove(&workspace_id)
496 .unwrap_or_default();
497 self.bump_revision();
498 self.save_to_file();
499 cx.notify();
500 }
501
502 pub fn remove_workspace(&mut self, workspace_id: Uuid) {
503 if workspace_id != self.active_workspace_id {
504 self.workspace_collections.remove(&workspace_id);
505 self.save_to_file();
506 }
507 }
508
509 fn bump_revision(&mut self) {
510 self.revision = self.revision.wrapping_add(1);
511 }
512
513 /// Monotonically changes whenever the collection tree changes. Views use this
514 /// to rebuild their virtualized snapshots only when the source data changes.
515 pub fn revision(&self) -> u64 {
516 self.revision
517 }

Callers 1

Calls 3

find_node_mutFunction · 0.85
folder_mutMethod · 0.80
save_to_fileMethod · 0.45

Tested by

no test coverage detected