Skip to content

Commit 7880d65

Browse files
authored
0.5.10 core library update (#155)
* advance to core library version 0.5.10 - update PatchAction API to reflect marks changes * corresponding API updates for removing Marks from Patch:Insert * rustfmt cleanup
1 parent 11250a1 commit 7880d65

File tree

6 files changed

+44
-54
lines changed

6 files changed

+44
-54
lines changed

AutomergeUniffi/automerge.swift

+15-16
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,12 @@ open class Doc:
642642
}
643643

644644
public convenience init() {
645-
let pointer = try! rustCall {
646-
uniffi_uniffi_automerge_fn_constructor_doc_new(
647-
$0
648-
)
649-
}
645+
let pointer =
646+
try! rustCall {
647+
uniffi_uniffi_automerge_fn_constructor_doc_new(
648+
$0
649+
)
650+
}
650651
self.init(unsafeFromRawPointer: pointer)
651652
}
652653

@@ -1385,11 +1386,12 @@ open class SyncState:
13851386
}
13861387

13871388
public convenience init() {
1388-
let pointer = try! rustCall {
1389-
uniffi_uniffi_automerge_fn_constructor_syncstate_new(
1390-
$0
1391-
)
1392-
}
1389+
let pointer =
1390+
try! rustCall {
1391+
uniffi_uniffi_automerge_fn_constructor_syncstate_new(
1392+
$0
1393+
)
1394+
}
13931395
self.init(unsafeFromRawPointer: pointer)
13941396
}
13951397

@@ -1998,8 +2000,7 @@ public enum PatchAction {
19982000
case insert(
19992001
obj: ObjId,
20002002
index: UInt64,
2001-
values: [Value],
2002-
marks: [String: Value]
2003+
values: [Value]
20032004
)
20042005
case spliceText(
20052006
obj: ObjId,
@@ -2046,8 +2047,7 @@ public struct FfiConverterTypePatchAction: FfiConverterRustBuffer {
20462047
case 2: return try .insert(
20472048
obj: FfiConverterTypeObjId.read(from: &buf),
20482049
index: FfiConverterUInt64.read(from: &buf),
2049-
values: FfiConverterSequenceTypeValue.read(from: &buf),
2050-
marks: FfiConverterDictionaryStringTypeValue.read(from: &buf)
2050+
values: FfiConverterSequenceTypeValue.read(from: &buf)
20512051
)
20522052

20532053
case 3: return try .spliceText(
@@ -2096,12 +2096,11 @@ public struct FfiConverterTypePatchAction: FfiConverterRustBuffer {
20962096
FfiConverterTypeProp.write(prop, into: &buf)
20972097
FfiConverterTypeValue.write(value, into: &buf)
20982098

2099-
case let .insert(obj, index, values, marks):
2099+
case let .insert(obj, index, values):
21002100
writeInt(&buf, Int32(2))
21012101
FfiConverterTypeObjId.write(obj, into: &buf)
21022102
FfiConverterUInt64.write(index, into: &buf)
21032103
FfiConverterSequenceTypeValue.write(values, into: &buf)
2104-
FfiConverterDictionaryStringTypeValue.write(marks, into: &buf)
21052104

21062105
case let .spliceText(obj, index, value, marks):
21072106
writeInt(&buf, Int32(3))

Sources/Automerge/Patch.swift

+4-7
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ public enum PatchAction: Equatable {
5050
///
5151
/// The property included within the `Put` can be either an index to a sequence, or a key into a map.
5252
case Put(ObjId, Prop, Value)
53-
/// Insert a collection of values at the index you provide for the identified object with the given marks
54-
///
55-
/// `marks` will only be set for text objects.
56-
case Insert(obj: ObjId, index: UInt64, values: [Value], marks: [String: Value])
53+
/// Insert a collection of values at the index you provide for the identified object.
54+
case Insert(obj: ObjId, index: UInt64, values: [Value])
5755
/// Splices characters into and/or removes characters from the identified object at a given position within it.
5856
///
5957
/// > Note: The unsigned 64bit integer is the index to a UTF-8 code point, and not a grapheme cluster index.
@@ -77,12 +75,11 @@ public enum PatchAction: Equatable {
7775
switch ffi {
7876
case let .put(obj, prop, value):
7977
return .Put(ObjId(bytes: obj), Prop.fromFfi(prop), Value.fromFfi(value: value))
80-
case let .insert(obj, index, values, marks):
78+
case let .insert(obj, index, values):
8179
return .Insert(
8280
obj: ObjId(bytes: obj),
8381
index: index,
84-
values: values.map { Value.fromFfi(value: $0) },
85-
marks: marks.mapValues(Value.fromFfi)
82+
values: values.map { Value.fromFfi(value: $0) }
8683
)
8784
case let .spliceText(obj, index, value, marks):
8885
return .SpliceText(

rust/Cargo.lock

+20-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ path = "uniffi-bindgen.rs"
1313
required-features = ["uniffi/cli"]
1414

1515
[dependencies]
16-
automerge = "0.5.9"
16+
automerge = "0.5.10"
1717
thiserror = "1.0.38"
18-
uniffi = "0.27.0"
18+
uniffi = "0.27.1"
1919

2020
[build-dependencies]
21-
uniffi = {version = "0.27.0", features = ["build"] }
21+
uniffi = {version = "0.27.1", features = ["build"] }
2222

rust/src/automerge.udl

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ dictionary Patch {
120120
[Enum]
121121
interface PatchAction {
122122
Put( ObjId obj, Prop prop, Value value);
123-
Insert( ObjId obj, u64 index, sequence<Value> values, record<string, Value> marks);
123+
Insert( ObjId obj, u64 index, sequence<Value> values);
124124
SpliceText( ObjId obj, u64 index, string value, record<string, Value> marks);
125125
Increment( ObjId obj, Prop prop, i64 value);
126126
Conflict( ObjId obj, Prop prop);

rust/src/patches.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub enum PatchAction {
3434
obj: ObjId,
3535
index: u64,
3636
values: Vec<Value>,
37-
marks: HashMap<String, Value>,
3837
},
3938
SpliceText {
4039
obj: ObjId,
@@ -81,18 +80,13 @@ impl PatchAction {
8180
},
8281
value: value.into(),
8382
},
84-
am::PatchAction::Insert {
85-
index,
86-
values,
87-
marks,
88-
} => PatchAction::Insert {
83+
am::PatchAction::Insert { index, values } => PatchAction::Insert {
8984
obj: obj.into(),
9085
index: index as u64,
9186
values: values
9287
.into_iter()
9388
.map(|(v, id, _conflict)| Value::from((v.clone(), id.clone())))
9489
.collect(),
95-
marks: convert_marks(marks),
9690
},
9791
am::PatchAction::SpliceText {
9892
index,

0 commit comments

Comments
 (0)