diff options
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/sync.rs | 7 |
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> { |
