Skip to content

Commit

Permalink
Change docupdates (#130)
Browse files Browse the repository at this point in the history
* getting rustfmt happy
* adding surrounding documentation and curation to add Change into the overall docs
  • Loading branch information
heckj authored Mar 15, 2024
1 parent e0e67e1 commit f384adc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions Sources/Automerge/Automerge.docc/Automerge.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Read <doc:FiveMinuteQuickstart> to get a quick taste of how to use Automerge, or

- <doc:ChangesAndHistory>
- ``Automerge/ChangeHash``
- ``Automerge/Change``
- ``Automerge/Patch``
- ``Automerge/PatchAction``
- ``Automerge/PathElement``
Expand Down
17 changes: 17 additions & 0 deletions Sources/Automerge/Automerge.docc/Curation/Change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ``Automerge/Change``

## Topics

### Inspecting a Change

- ``Change/hash``
- ``Change/actorId``
- ``Change/deps``
- ``Change/bytes``
- ``ChangeHash/debugDescription``

### Inspecting Change Metadata

- ``Change/message``
- ``Change/timestamp``

2 changes: 2 additions & 0 deletions Sources/Automerge/Automerge.docc/Curation/Document.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@

- ``heads()``
- ``getHistory()``
- ``change(hash:)``

### Reading historical map values

Expand All @@ -100,6 +101,7 @@
### Saving, forking, and merging documents

- ``save()``
- ``commitWith(message:timestamp:)``
- ``encodeNewChanges()``
- ``encodeChangesSince(heads:)``
- ``applyEncodedChanges(encoded:)``
Expand Down
7 changes: 7 additions & 0 deletions Sources/Automerge/Change.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ import Foundation

typealias FfiChange = AutomergeUniffi.Change

/// A type that encapsulates a change, and any associated metadata, to an Automerge document.
public struct Change: Equatable {
/// The identity of the actor that made the change.
public let actorId: ActorId
/// An optional message associated with the change.
public let message: String?
/// The list of changes that this change depends upon.
public let deps: [ChangeHash]
/// The timestamp of the change.
public let timestamp: Date
/// The encoded bytes of the change operation.
public let bytes: Data
/// The identity of the change, its hash.
public let hash: ChangeHash

init(_ ffi: FfiChange) {
Expand Down
2 changes: 1 addition & 1 deletion rust/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::actor_id::ActorId;
use crate::mark::{ExpandMark, Mark};
use crate::patches::Patch;
use crate::{
Change, ChangeHash, Cursor, ObjId, ObjType, PathElement, ScalarValue, SyncState, Value
Change, ChangeHash, Cursor, ObjId, ObjType, PathElement, ScalarValue, SyncState, Value,
};

#[derive(Debug, thiserror::Error)]
Expand Down

0 comments on commit f384adc

Please sign in to comment.