aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-03 06:23:23 +0100
committertv <tv@krebsco.de>2026-11-03 06:23:23 +0100
commit4559c4427fcdebe1b816ce8c4e651cf11571b7d5 (patch)
treebeefb9ad0b91145f4a4dbaec67fb09501f4bb525 /src/document
parentb16977b18fdd1e5193f5c015eadcb61a63f4fae1 (diff)
tree changes had already
Diffstat (limited to 'src/document')
-rw-r--r--src/document/sync.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/document/sync.rs b/src/document/sync.rs
index 44ad833..4a3fe5e 100644
--- a/src/document/sync.rs
+++ b/src/document/sync.rs
@@ -22,6 +22,13 @@ use crate::transport::SyncPayload;
/// A sync message from a peer, decoded (`decode`), to apply (`SyncSession::receive`).
pub(crate) struct Received(sync::Message);
+impl Received {
+ /// Whether it carries changes (it may carry only heads and what the peer needs).
+ pub(crate) fn carries_changes(&self) -> bool {
+ !self.0.changes.is_empty()
+ }
+}
+
/// `payload` decoded. Before taking the document's lock: decoding a large message takes
/// a while.
pub(crate) fn decode(payload: &SyncPayload) -> anyhow::Result<Received> {