From 6105507200231e67ba544c12aa10b988e1c23826 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 19:53:27 +0100 Subject: use Automerge as Document instead of AutoCommit This allows a lot of operations to drop mut. --- src/api/document.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/document.rs') diff --git a/src/api/document.rs b/src/api/document.rs index 08fd21f..bc8c47e 100644 --- a/src/api/document.rs +++ b/src/api/document.rs @@ -50,11 +50,11 @@ pub(crate) async fn get_document(State(state): State) -> Response { // Both steps take time proportional to the document: off the async threads, and // the lock only for the copy. let saved = tokio::task::spawn_blocking(move || { - let (mut copy, epoch, heads) = { + let (copy, epoch, heads) = { let replica = doc.blocking_read(); (replica.doc.clone(), replica.epoch, replica.heads().to_vec()) }; - (crate::document::save(&mut copy), heads, epoch) + (crate::document::save(©), heads, epoch) }) .await; let (bytes, heads, epoch) = match saved { -- cgit v1.3.1