@openeditor/react-native-prose-editor 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +180 -0
  3. package/android/build.gradle +69 -0
  4. package/android/consumer-rules.pro +18 -0
  5. package/android/src/androidTest/AndroidManifest.xml +8 -0
  6. package/android/src/androidTest/java/com/apollohg/editor/MeasureHeightInstrumentedTest.kt +53 -0
  7. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceCollaborationInitialSyncTest.kt +241 -0
  8. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceImeRegressionTest.kt +338 -0
  9. package/android/src/androidTest/java/com/apollohg/editor/NativeDeviceOutsideTapTest.kt +789 -0
  10. package/android/src/androidTest/java/com/apollohg/editor/NativeDevicePerformanceTest.kt +350 -0
  11. package/android/src/androidTest/java/com/apollohg/editor/NativeEditorOutsideTapActivity.kt +5 -0
  12. package/android/src/main/assets/editor-icons/MaterialIcons.json +2236 -0
  13. package/android/src/main/assets/editor-icons/MaterialIcons.ttf +0 -0
  14. package/android/src/main/java/com/apollohg/editor/CaretGeometry.kt +50 -0
  15. package/android/src/main/java/com/apollohg/editor/EditorAddons.kt +135 -0
  16. package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +4527 -0
  17. package/android/src/main/java/com/apollohg/editor/EditorHeightBehavior.kt +14 -0
  18. package/android/src/main/java/com/apollohg/editor/EditorInputConnection.kt +999 -0
  19. package/android/src/main/java/com/apollohg/editor/EditorTheme.kt +474 -0
  20. package/android/src/main/java/com/apollohg/editor/ImageResizeOverlayView.kt +199 -0
  21. package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +3137 -0
  22. package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +561 -0
  23. package/android/src/main/java/com/apollohg/editor/NativeProseViewerExpoView.kt +315 -0
  24. package/android/src/main/java/com/apollohg/editor/NativeToolbar.kt +1413 -0
  25. package/android/src/main/java/com/apollohg/editor/PositionBridge.kt +133 -0
  26. package/android/src/main/java/com/apollohg/editor/RemoteSelectionOverlayView.kt +315 -0
  27. package/android/src/main/java/com/apollohg/editor/RenderBridge.kt +2172 -0
  28. package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +399 -0
  29. package/android/src/sharedTest/java/com/apollohg/editor/NativePerformanceSupport.kt +482 -0
  30. package/android/src/test/java/com/apollohg/editor/CaretGeometryTest.kt +137 -0
  31. package/android/src/test/java/com/apollohg/editor/EditorEditTextHardwareKeyTest.kt +321 -0
  32. package/android/src/test/java/com/apollohg/editor/EditorInputConnectionTest.kt +4202 -0
  33. package/android/src/test/java/com/apollohg/editor/NativeEditorExpoViewTest.kt +2581 -0
  34. package/android/src/test/java/com/apollohg/editor/NativeEditorModuleTest.kt +27 -0
  35. package/android/src/test/java/com/apollohg/editor/NativePerformanceTest.kt +197 -0
  36. package/android/src/test/java/com/apollohg/editor/NativeProseViewerExpoViewTest.kt +84 -0
  37. package/android/src/test/java/com/apollohg/editor/NativeToolbarTest.kt +544 -0
  38. package/android/src/test/java/com/apollohg/editor/PositionBridgeTest.kt +461 -0
  39. package/android/src/test/java/com/apollohg/editor/RenderBridgeTest.kt +2054 -0
  40. package/android/src/test/java/com/apollohg/editor/RichTextEditorViewTest.kt +1367 -0
  41. package/app.plugin.js +62 -0
  42. package/dist/EditorTheme.d.ts +113 -0
  43. package/dist/EditorTheme.js +29 -0
  44. package/dist/EditorToolbar.d.ts +191 -0
  45. package/dist/EditorToolbar.js +1095 -0
  46. package/dist/NativeEditorBridge.d.ts +325 -0
  47. package/dist/NativeEditorBridge.js +933 -0
  48. package/dist/NativeProseViewer.d.ts +53 -0
  49. package/dist/NativeProseViewer.js +480 -0
  50. package/dist/NativeRichTextEditor.d.ts +183 -0
  51. package/dist/NativeRichTextEditor.js +2574 -0
  52. package/dist/YjsCollaboration.d.ts +90 -0
  53. package/dist/YjsCollaboration.js +743 -0
  54. package/dist/addons.d.ts +100 -0
  55. package/dist/addons.js +82 -0
  56. package/dist/heightCache.d.ts +6 -0
  57. package/dist/heightCache.js +45 -0
  58. package/dist/index.d.ts +10 -0
  59. package/dist/index.js +30 -0
  60. package/dist/schemas.d.ts +37 -0
  61. package/dist/schemas.js +263 -0
  62. package/dist/useNativeEditor.d.ts +42 -0
  63. package/dist/useNativeEditor.js +124 -0
  64. package/expo-module.config.json +9 -0
  65. package/ios/EditorAddons.swift +327 -0
  66. package/ios/EditorCore.xcframework/Info.plist +44 -0
  67. package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
  68. package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
  69. package/ios/EditorLayoutManager.swift +774 -0
  70. package/ios/EditorTheme.swift +515 -0
  71. package/ios/Generated_editor_core.swift +1513 -0
  72. package/ios/NativeEditorExpoView.swift +3593 -0
  73. package/ios/NativeEditorModule.swift +624 -0
  74. package/ios/NativeProseViewerExpoView.swift +276 -0
  75. package/ios/PositionBridge.swift +558 -0
  76. package/ios/ReactNativeProseEditor.podspec +49 -0
  77. package/ios/RenderBridge.swift +1708 -0
  78. package/ios/RichTextEditorView.swift +6150 -0
  79. package/ios/Tests/NativePerformanceTests.swift +687 -0
  80. package/ios/Tests/PositionBridgeTests.swift +706 -0
  81. package/ios/Tests/RenderBridgeTests.swift +2236 -0
  82. package/ios/Tests/RichTextEditorViewTests.swift +6548 -0
  83. package/ios/editor_coreFFI/editor_coreFFI.h +1289 -0
  84. package/ios/editor_coreFFI/module.modulemap +7 -0
  85. package/ios/editor_coreFFI.h +904 -0
  86. package/ios/editor_coreFFI.modulemap +7 -0
  87. package/package.json +74 -0
  88. package/rust/android/arm64-v8a/libeditor_core.so +0 -0
  89. package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
  90. package/rust/android/x86_64/libeditor_core.so +0 -0
  91. package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +2563 -0
@@ -0,0 +1,2563 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi` crate.
2
+ // Trust me, you don't want to mess with it!
3
+
4
+ @file:Suppress("NAME_SHADOWING")
5
+
6
+ package uniffi.editor_core
7
+
8
+ // Common helper code.
9
+ //
10
+ // Ideally this would live in a separate .kt file where it can be unittested etc
11
+ // in isolation, and perhaps even published as a re-useable package.
12
+ //
13
+ // However, it's important that the details of how this helper code works (e.g. the
14
+ // way that different builtin types are passed across the FFI) exactly match what's
15
+ // expected by the Rust code on the other side of the interface. In practice right
16
+ // now that means coming from the exact some version of `uniffi` that was used to
17
+ // compile the Rust component. The easiest way to ensure this is to bundle the Kotlin
18
+ // helpers directly inline like we're doing here.
19
+
20
+ import com.sun.jna.Library
21
+ import com.sun.jna.IntegerType
22
+ import com.sun.jna.Native
23
+ import com.sun.jna.Pointer
24
+ import com.sun.jna.Structure
25
+ import com.sun.jna.Callback
26
+ import com.sun.jna.ptr.*
27
+ import java.nio.ByteBuffer
28
+ import java.nio.ByteOrder
29
+ import java.nio.CharBuffer
30
+ import java.nio.charset.CodingErrorAction
31
+ import java.util.concurrent.atomic.AtomicLong
32
+ import java.util.concurrent.ConcurrentHashMap
33
+
34
+ // This is a helper for safely working with byte buffers returned from the Rust code.
35
+ // A rust-owned buffer is represented by its capacity, its current length, and a
36
+ // pointer to the underlying data.
37
+
38
+ /**
39
+ * @suppress
40
+ */
41
+ @Structure.FieldOrder("capacity", "len", "data")
42
+ open class RustBuffer : Structure() {
43
+ // Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values.
44
+ // When dealing with these fields, make sure to call `toULong()`.
45
+ @JvmField var capacity: Long = 0
46
+ @JvmField var len: Long = 0
47
+ @JvmField var data: Pointer? = null
48
+
49
+ class ByValue: RustBuffer(), Structure.ByValue
50
+ class ByReference: RustBuffer(), Structure.ByReference
51
+
52
+ internal fun setValue(other: RustBuffer) {
53
+ capacity = other.capacity
54
+ len = other.len
55
+ data = other.data
56
+ }
57
+
58
+ companion object {
59
+ internal fun alloc(size: ULong = 0UL) = uniffiRustCall() { status ->
60
+ // Note: need to convert the size to a `Long` value to make this work with JVM.
61
+ UniffiLib.INSTANCE.ffi_editor_core_rustbuffer_alloc(size.toLong(), status)
62
+ }.also {
63
+ if(it.data == null) {
64
+ throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
65
+ }
66
+ }
67
+
68
+ internal fun create(capacity: ULong, len: ULong, data: Pointer?): RustBuffer.ByValue {
69
+ var buf = RustBuffer.ByValue()
70
+ buf.capacity = capacity.toLong()
71
+ buf.len = len.toLong()
72
+ buf.data = data
73
+ return buf
74
+ }
75
+
76
+ internal fun free(buf: RustBuffer.ByValue) = uniffiRustCall() { status ->
77
+ UniffiLib.INSTANCE.ffi_editor_core_rustbuffer_free(buf, status)
78
+ }
79
+ }
80
+
81
+ @Suppress("TooGenericExceptionThrown")
82
+ fun asByteBuffer() =
83
+ this.data?.getByteBuffer(0, this.len.toLong())?.also {
84
+ it.order(ByteOrder.BIG_ENDIAN)
85
+ }
86
+ }
87
+
88
+ /**
89
+ * The equivalent of the `*mut RustBuffer` type.
90
+ * Required for callbacks taking in an out pointer.
91
+ *
92
+ * Size is the sum of all values in the struct.
93
+ *
94
+ * @suppress
95
+ */
96
+ class RustBufferByReference : ByReference(16) {
97
+ /**
98
+ * Set the pointed-to `RustBuffer` to the given value.
99
+ */
100
+ fun setValue(value: RustBuffer.ByValue) {
101
+ // NOTE: The offsets are as they are in the C-like struct.
102
+ val pointer = getPointer()
103
+ pointer.setLong(0, value.capacity)
104
+ pointer.setLong(8, value.len)
105
+ pointer.setPointer(16, value.data)
106
+ }
107
+
108
+ /**
109
+ * Get a `RustBuffer.ByValue` from this reference.
110
+ */
111
+ fun getValue(): RustBuffer.ByValue {
112
+ val pointer = getPointer()
113
+ val value = RustBuffer.ByValue()
114
+ value.writeField("capacity", pointer.getLong(0))
115
+ value.writeField("len", pointer.getLong(8))
116
+ value.writeField("data", pointer.getLong(16))
117
+
118
+ return value
119
+ }
120
+ }
121
+
122
+ // This is a helper for safely passing byte references into the rust code.
123
+ // It's not actually used at the moment, because there aren't many things that you
124
+ // can take a direct pointer to in the JVM, and if we're going to copy something
125
+ // then we might as well copy it into a `RustBuffer`. But it's here for API
126
+ // completeness.
127
+
128
+ @Structure.FieldOrder("len", "data")
129
+ internal open class ForeignBytes : Structure() {
130
+ @JvmField var len: Int = 0
131
+ @JvmField var data: Pointer? = null
132
+
133
+ class ByValue : ForeignBytes(), Structure.ByValue
134
+ }
135
+ /**
136
+ * The FfiConverter interface handles converter types to and from the FFI
137
+ *
138
+ * All implementing objects should be public to support external types. When a
139
+ * type is external we need to import it's FfiConverter.
140
+ *
141
+ * @suppress
142
+ */
143
+ public interface FfiConverter<KotlinType, FfiType> {
144
+ // Convert an FFI type to a Kotlin type
145
+ fun lift(value: FfiType): KotlinType
146
+
147
+ // Convert an Kotlin type to an FFI type
148
+ fun lower(value: KotlinType): FfiType
149
+
150
+ // Read a Kotlin type from a `ByteBuffer`
151
+ fun read(buf: ByteBuffer): KotlinType
152
+
153
+ // Calculate bytes to allocate when creating a `RustBuffer`
154
+ //
155
+ // This must return at least as many bytes as the write() function will
156
+ // write. It can return more bytes than needed, for example when writing
157
+ // Strings we can't know the exact bytes needed until we the UTF-8
158
+ // encoding, so we pessimistically allocate the largest size possible (3
159
+ // bytes per codepoint). Allocating extra bytes is not really a big deal
160
+ // because the `RustBuffer` is short-lived.
161
+ fun allocationSize(value: KotlinType): ULong
162
+
163
+ // Write a Kotlin type to a `ByteBuffer`
164
+ fun write(value: KotlinType, buf: ByteBuffer)
165
+
166
+ // Lower a value into a `RustBuffer`
167
+ //
168
+ // This method lowers a value into a `RustBuffer` rather than the normal
169
+ // FfiType. It's used by the callback interface code. Callback interface
170
+ // returns are always serialized into a `RustBuffer` regardless of their
171
+ // normal FFI type.
172
+ fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
173
+ val rbuf = RustBuffer.alloc(allocationSize(value))
174
+ try {
175
+ val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
176
+ it.order(ByteOrder.BIG_ENDIAN)
177
+ }
178
+ write(value, bbuf)
179
+ rbuf.writeField("len", bbuf.position().toLong())
180
+ return rbuf
181
+ } catch (e: Throwable) {
182
+ RustBuffer.free(rbuf)
183
+ throw e
184
+ }
185
+ }
186
+
187
+ // Lift a value from a `RustBuffer`.
188
+ //
189
+ // This here mostly because of the symmetry with `lowerIntoRustBuffer()`.
190
+ // It's currently only used by the `FfiConverterRustBuffer` class below.
191
+ fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType {
192
+ val byteBuf = rbuf.asByteBuffer()!!
193
+ try {
194
+ val item = read(byteBuf)
195
+ if (byteBuf.hasRemaining()) {
196
+ throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!")
197
+ }
198
+ return item
199
+ } finally {
200
+ RustBuffer.free(rbuf)
201
+ }
202
+ }
203
+ }
204
+
205
+ /**
206
+ * FfiConverter that uses `RustBuffer` as the FfiType
207
+ *
208
+ * @suppress
209
+ */
210
+ public interface FfiConverterRustBuffer<KotlinType>: FfiConverter<KotlinType, RustBuffer.ByValue> {
211
+ override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
212
+ override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
213
+ }
214
+ // A handful of classes and functions to support the generated data structures.
215
+ // This would be a good candidate for isolating in its own ffi-support lib.
216
+
217
+ internal const val UNIFFI_CALL_SUCCESS = 0.toByte()
218
+ internal const val UNIFFI_CALL_ERROR = 1.toByte()
219
+ internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
220
+
221
+ @Structure.FieldOrder("code", "error_buf")
222
+ internal open class UniffiRustCallStatus : Structure() {
223
+ @JvmField var code: Byte = 0
224
+ @JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
225
+
226
+ class ByValue: UniffiRustCallStatus(), Structure.ByValue
227
+
228
+ fun isSuccess(): Boolean {
229
+ return code == UNIFFI_CALL_SUCCESS
230
+ }
231
+
232
+ fun isError(): Boolean {
233
+ return code == UNIFFI_CALL_ERROR
234
+ }
235
+
236
+ fun isPanic(): Boolean {
237
+ return code == UNIFFI_CALL_UNEXPECTED_ERROR
238
+ }
239
+
240
+ companion object {
241
+ fun create(code: Byte, errorBuf: RustBuffer.ByValue): UniffiRustCallStatus.ByValue {
242
+ val callStatus = UniffiRustCallStatus.ByValue()
243
+ callStatus.code = code
244
+ callStatus.error_buf = errorBuf
245
+ return callStatus
246
+ }
247
+ }
248
+ }
249
+
250
+ class InternalException(message: String) : kotlin.Exception(message)
251
+
252
+ /**
253
+ * Each top-level error class has a companion object that can lift the error from the call status's rust buffer
254
+ *
255
+ * @suppress
256
+ */
257
+ interface UniffiRustCallStatusErrorHandler<E> {
258
+ fun lift(error_buf: RustBuffer.ByValue): E;
259
+ }
260
+
261
+ // Helpers for calling Rust
262
+ // In practice we usually need to be synchronized to call this safely, so it doesn't
263
+ // synchronize itself
264
+
265
+ // Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
266
+ private inline fun <U, E: kotlin.Exception> uniffiRustCallWithError(errorHandler: UniffiRustCallStatusErrorHandler<E>, callback: (UniffiRustCallStatus) -> U): U {
267
+ var status = UniffiRustCallStatus()
268
+ val return_value = callback(status)
269
+ uniffiCheckCallStatus(errorHandler, status)
270
+ return return_value
271
+ }
272
+
273
+ // Check UniffiRustCallStatus and throw an error if the call wasn't successful
274
+ private fun<E: kotlin.Exception> uniffiCheckCallStatus(errorHandler: UniffiRustCallStatusErrorHandler<E>, status: UniffiRustCallStatus) {
275
+ if (status.isSuccess()) {
276
+ return
277
+ } else if (status.isError()) {
278
+ throw errorHandler.lift(status.error_buf)
279
+ } else if (status.isPanic()) {
280
+ // when the rust code sees a panic, it tries to construct a rustbuffer
281
+ // with the message. but if that code panics, then it just sends back
282
+ // an empty buffer.
283
+ if (status.error_buf.len > 0) {
284
+ throw InternalException(FfiConverterString.lift(status.error_buf))
285
+ } else {
286
+ throw InternalException("Rust panic")
287
+ }
288
+ } else {
289
+ throw InternalException("Unknown rust call status: $status.code")
290
+ }
291
+ }
292
+
293
+ /**
294
+ * UniffiRustCallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR
295
+ *
296
+ * @suppress
297
+ */
298
+ object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler<InternalException> {
299
+ override fun lift(error_buf: RustBuffer.ByValue): InternalException {
300
+ RustBuffer.free(error_buf)
301
+ return InternalException("Unexpected CALL_ERROR")
302
+ }
303
+ }
304
+
305
+ // Call a rust function that returns a plain value
306
+ private inline fun <U> uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U {
307
+ return uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback)
308
+ }
309
+
310
+ internal inline fun<T> uniffiTraitInterfaceCall(
311
+ callStatus: UniffiRustCallStatus,
312
+ makeCall: () -> T,
313
+ writeReturn: (T) -> Unit,
314
+ ) {
315
+ try {
316
+ writeReturn(makeCall())
317
+ } catch(e: kotlin.Exception) {
318
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
319
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
320
+ }
321
+ }
322
+
323
+ internal inline fun<T, reified E: Throwable> uniffiTraitInterfaceCallWithError(
324
+ callStatus: UniffiRustCallStatus,
325
+ makeCall: () -> T,
326
+ writeReturn: (T) -> Unit,
327
+ lowerError: (E) -> RustBuffer.ByValue
328
+ ) {
329
+ try {
330
+ writeReturn(makeCall())
331
+ } catch(e: kotlin.Exception) {
332
+ if (e is E) {
333
+ callStatus.code = UNIFFI_CALL_ERROR
334
+ callStatus.error_buf = lowerError(e)
335
+ } else {
336
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
337
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
338
+ }
339
+ }
340
+ }
341
+ // Map handles to objects
342
+ //
343
+ // This is used pass an opaque 64-bit handle representing a foreign object to the Rust code.
344
+ internal class UniffiHandleMap<T: Any> {
345
+ private val map = ConcurrentHashMap<Long, T>()
346
+ private val counter = java.util.concurrent.atomic.AtomicLong(0)
347
+
348
+ val size: Int
349
+ get() = map.size
350
+
351
+ // Insert a new object into the handle map and get a handle for it
352
+ fun insert(obj: T): Long {
353
+ val handle = counter.getAndAdd(1)
354
+ map.put(handle, obj)
355
+ return handle
356
+ }
357
+
358
+ // Get an object from the handle map
359
+ fun get(handle: Long): T {
360
+ return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
361
+ }
362
+
363
+ // Remove an entry from the handlemap and get the Kotlin object back
364
+ fun remove(handle: Long): T {
365
+ return map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
366
+ }
367
+ }
368
+
369
+ // Contains loading, initialization code,
370
+ // and the FFI Function declarations in a com.sun.jna.Library.
371
+ @Synchronized
372
+ private fun findLibraryName(componentName: String): String {
373
+ val libOverride = System.getProperty("uniffi.component.$componentName.libraryOverride")
374
+ if (libOverride != null) {
375
+ return libOverride
376
+ }
377
+ return "editor_core"
378
+ }
379
+
380
+ private inline fun <reified Lib : Library> loadIndirect(
381
+ componentName: String
382
+ ): Lib {
383
+ return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
384
+ }
385
+
386
+ // Define FFI callback types
387
+ internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
388
+ fun callback(`data`: Long,`pollResult`: Byte,)
389
+ }
390
+ internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
391
+ fun callback(`handle`: Long,)
392
+ }
393
+ internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
394
+ fun callback(`handle`: Long,)
395
+ }
396
+ @Structure.FieldOrder("handle", "free")
397
+ internal open class UniffiForeignFuture(
398
+ @JvmField internal var `handle`: Long = 0.toLong(),
399
+ @JvmField internal var `free`: UniffiForeignFutureFree? = null,
400
+ ) : Structure() {
401
+ class UniffiByValue(
402
+ `handle`: Long = 0.toLong(),
403
+ `free`: UniffiForeignFutureFree? = null,
404
+ ): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue
405
+
406
+ internal fun uniffiSetValue(other: UniffiForeignFuture) {
407
+ `handle` = other.`handle`
408
+ `free` = other.`free`
409
+ }
410
+
411
+ }
412
+ @Structure.FieldOrder("returnValue", "callStatus")
413
+ internal open class UniffiForeignFutureStructU8(
414
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
415
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
416
+ ) : Structure() {
417
+ class UniffiByValue(
418
+ `returnValue`: Byte = 0.toByte(),
419
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
420
+ ): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue
421
+
422
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
423
+ `returnValue` = other.`returnValue`
424
+ `callStatus` = other.`callStatus`
425
+ }
426
+
427
+ }
428
+ internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
429
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,)
430
+ }
431
+ @Structure.FieldOrder("returnValue", "callStatus")
432
+ internal open class UniffiForeignFutureStructI8(
433
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
434
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
435
+ ) : Structure() {
436
+ class UniffiByValue(
437
+ `returnValue`: Byte = 0.toByte(),
438
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
439
+ ): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue
440
+
441
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
442
+ `returnValue` = other.`returnValue`
443
+ `callStatus` = other.`callStatus`
444
+ }
445
+
446
+ }
447
+ internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
448
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,)
449
+ }
450
+ @Structure.FieldOrder("returnValue", "callStatus")
451
+ internal open class UniffiForeignFutureStructU16(
452
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
453
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
454
+ ) : Structure() {
455
+ class UniffiByValue(
456
+ `returnValue`: Short = 0.toShort(),
457
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
458
+ ): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue
459
+
460
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
461
+ `returnValue` = other.`returnValue`
462
+ `callStatus` = other.`callStatus`
463
+ }
464
+
465
+ }
466
+ internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
467
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,)
468
+ }
469
+ @Structure.FieldOrder("returnValue", "callStatus")
470
+ internal open class UniffiForeignFutureStructI16(
471
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
472
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
473
+ ) : Structure() {
474
+ class UniffiByValue(
475
+ `returnValue`: Short = 0.toShort(),
476
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
477
+ ): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue
478
+
479
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
480
+ `returnValue` = other.`returnValue`
481
+ `callStatus` = other.`callStatus`
482
+ }
483
+
484
+ }
485
+ internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
486
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,)
487
+ }
488
+ @Structure.FieldOrder("returnValue", "callStatus")
489
+ internal open class UniffiForeignFutureStructU32(
490
+ @JvmField internal var `returnValue`: Int = 0,
491
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
492
+ ) : Structure() {
493
+ class UniffiByValue(
494
+ `returnValue`: Int = 0,
495
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
496
+ ): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue
497
+
498
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
499
+ `returnValue` = other.`returnValue`
500
+ `callStatus` = other.`callStatus`
501
+ }
502
+
503
+ }
504
+ internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
505
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,)
506
+ }
507
+ @Structure.FieldOrder("returnValue", "callStatus")
508
+ internal open class UniffiForeignFutureStructI32(
509
+ @JvmField internal var `returnValue`: Int = 0,
510
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
511
+ ) : Structure() {
512
+ class UniffiByValue(
513
+ `returnValue`: Int = 0,
514
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
515
+ ): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue
516
+
517
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
518
+ `returnValue` = other.`returnValue`
519
+ `callStatus` = other.`callStatus`
520
+ }
521
+
522
+ }
523
+ internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
524
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,)
525
+ }
526
+ @Structure.FieldOrder("returnValue", "callStatus")
527
+ internal open class UniffiForeignFutureStructU64(
528
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
529
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
530
+ ) : Structure() {
531
+ class UniffiByValue(
532
+ `returnValue`: Long = 0.toLong(),
533
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
534
+ ): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue
535
+
536
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
537
+ `returnValue` = other.`returnValue`
538
+ `callStatus` = other.`callStatus`
539
+ }
540
+
541
+ }
542
+ internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
543
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,)
544
+ }
545
+ @Structure.FieldOrder("returnValue", "callStatus")
546
+ internal open class UniffiForeignFutureStructI64(
547
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
548
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
549
+ ) : Structure() {
550
+ class UniffiByValue(
551
+ `returnValue`: Long = 0.toLong(),
552
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
553
+ ): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue
554
+
555
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
556
+ `returnValue` = other.`returnValue`
557
+ `callStatus` = other.`callStatus`
558
+ }
559
+
560
+ }
561
+ internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
562
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,)
563
+ }
564
+ @Structure.FieldOrder("returnValue", "callStatus")
565
+ internal open class UniffiForeignFutureStructF32(
566
+ @JvmField internal var `returnValue`: Float = 0.0f,
567
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
568
+ ) : Structure() {
569
+ class UniffiByValue(
570
+ `returnValue`: Float = 0.0f,
571
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
572
+ ): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue
573
+
574
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
575
+ `returnValue` = other.`returnValue`
576
+ `callStatus` = other.`callStatus`
577
+ }
578
+
579
+ }
580
+ internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
581
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,)
582
+ }
583
+ @Structure.FieldOrder("returnValue", "callStatus")
584
+ internal open class UniffiForeignFutureStructF64(
585
+ @JvmField internal var `returnValue`: Double = 0.0,
586
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
587
+ ) : Structure() {
588
+ class UniffiByValue(
589
+ `returnValue`: Double = 0.0,
590
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
591
+ ): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue
592
+
593
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
594
+ `returnValue` = other.`returnValue`
595
+ `callStatus` = other.`callStatus`
596
+ }
597
+
598
+ }
599
+ internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
600
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,)
601
+ }
602
+ @Structure.FieldOrder("returnValue", "callStatus")
603
+ internal open class UniffiForeignFutureStructPointer(
604
+ @JvmField internal var `returnValue`: Pointer = Pointer.NULL,
605
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
606
+ ) : Structure() {
607
+ class UniffiByValue(
608
+ `returnValue`: Pointer = Pointer.NULL,
609
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
610
+ ): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue
611
+
612
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
613
+ `returnValue` = other.`returnValue`
614
+ `callStatus` = other.`callStatus`
615
+ }
616
+
617
+ }
618
+ internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
619
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,)
620
+ }
621
+ @Structure.FieldOrder("returnValue", "callStatus")
622
+ internal open class UniffiForeignFutureStructRustBuffer(
623
+ @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
624
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
625
+ ) : Structure() {
626
+ class UniffiByValue(
627
+ `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
628
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
629
+ ): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
630
+
631
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
632
+ `returnValue` = other.`returnValue`
633
+ `callStatus` = other.`callStatus`
634
+ }
635
+
636
+ }
637
+ internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
638
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,)
639
+ }
640
+ @Structure.FieldOrder("callStatus")
641
+ internal open class UniffiForeignFutureStructVoid(
642
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
643
+ ) : Structure() {
644
+ class UniffiByValue(
645
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
646
+ ): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue
647
+
648
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
649
+ `callStatus` = other.`callStatus`
650
+ }
651
+
652
+ }
653
+ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
654
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,)
655
+ }
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+ // For large crates we prevent `MethodTooLargeException` (see #2340)
851
+ // N.B. the name of the extension is very misleading, since it is
852
+ // rather `InterfaceTooLargeException`, caused by too many methods
853
+ // in the interface for large crates.
854
+ //
855
+ // By splitting the otherwise huge interface into two parts
856
+ // * UniffiLib
857
+ // * IntegrityCheckingUniffiLib (this)
858
+ // we allow for ~2x as many methods in the UniffiLib interface.
859
+ //
860
+ // The `ffi_uniffi_contract_version` method and all checksum methods are put
861
+ // into `IntegrityCheckingUniffiLib` and these methods are called only once,
862
+ // when the library is loaded.
863
+ internal interface IntegrityCheckingUniffiLib : Library {
864
+ // Integrity check functions only
865
+ fun uniffi_editor_core_checksum_func_collaboration_session_apply_encoded_state(
866
+ ): Short
867
+ fun uniffi_editor_core_checksum_func_collaboration_session_apply_local_document_json(
868
+ ): Short
869
+ fun uniffi_editor_core_checksum_func_collaboration_session_clear_local_awareness(
870
+ ): Short
871
+ fun uniffi_editor_core_checksum_func_collaboration_session_create(
872
+ ): Short
873
+ fun uniffi_editor_core_checksum_func_collaboration_session_destroy(
874
+ ): Short
875
+ fun uniffi_editor_core_checksum_func_collaboration_session_get_document_json(
876
+ ): Short
877
+ fun uniffi_editor_core_checksum_func_collaboration_session_get_encoded_state(
878
+ ): Short
879
+ fun uniffi_editor_core_checksum_func_collaboration_session_get_peers_json(
880
+ ): Short
881
+ fun uniffi_editor_core_checksum_func_collaboration_session_handle_message(
882
+ ): Short
883
+ fun uniffi_editor_core_checksum_func_collaboration_session_replace_encoded_state(
884
+ ): Short
885
+ fun uniffi_editor_core_checksum_func_collaboration_session_set_local_awareness(
886
+ ): Short
887
+ fun uniffi_editor_core_checksum_func_collaboration_session_start(
888
+ ): Short
889
+ fun uniffi_editor_core_checksum_func_editor_can_redo(
890
+ ): Short
891
+ fun uniffi_editor_core_checksum_func_editor_can_undo(
892
+ ): Short
893
+ fun uniffi_editor_core_checksum_func_editor_core_version(
894
+ ): Short
895
+ fun uniffi_editor_core_checksum_func_editor_create(
896
+ ): Short
897
+ fun uniffi_editor_core_checksum_func_editor_delete_and_split_scalar(
898
+ ): Short
899
+ fun uniffi_editor_core_checksum_func_editor_delete_backward_at_selection_scalar(
900
+ ): Short
901
+ fun uniffi_editor_core_checksum_func_editor_delete_range(
902
+ ): Short
903
+ fun uniffi_editor_core_checksum_func_editor_delete_scalar_range(
904
+ ): Short
905
+ fun uniffi_editor_core_checksum_func_editor_destroy(
906
+ ): Short
907
+ fun uniffi_editor_core_checksum_func_editor_doc_to_scalar(
908
+ ): Short
909
+ fun uniffi_editor_core_checksum_func_editor_get_content_snapshot(
910
+ ): Short
911
+ fun uniffi_editor_core_checksum_func_editor_get_current_state(
912
+ ): Short
913
+ fun uniffi_editor_core_checksum_func_editor_get_html(
914
+ ): Short
915
+ fun uniffi_editor_core_checksum_func_editor_get_json(
916
+ ): Short
917
+ fun uniffi_editor_core_checksum_func_editor_get_selection(
918
+ ): Short
919
+ fun uniffi_editor_core_checksum_func_editor_get_selection_state(
920
+ ): Short
921
+ fun uniffi_editor_core_checksum_func_editor_indent_list_item(
922
+ ): Short
923
+ fun uniffi_editor_core_checksum_func_editor_indent_list_item_at_selection_scalar(
924
+ ): Short
925
+ fun uniffi_editor_core_checksum_func_editor_insert_content_html(
926
+ ): Short
927
+ fun uniffi_editor_core_checksum_func_editor_insert_content_json(
928
+ ): Short
929
+ fun uniffi_editor_core_checksum_func_editor_insert_content_json_at_selection_scalar(
930
+ ): Short
931
+ fun uniffi_editor_core_checksum_func_editor_insert_node(
932
+ ): Short
933
+ fun uniffi_editor_core_checksum_func_editor_insert_node_at_selection_scalar(
934
+ ): Short
935
+ fun uniffi_editor_core_checksum_func_editor_insert_text(
936
+ ): Short
937
+ fun uniffi_editor_core_checksum_func_editor_insert_text_scalar(
938
+ ): Short
939
+ fun uniffi_editor_core_checksum_func_editor_outdent_list_item(
940
+ ): Short
941
+ fun uniffi_editor_core_checksum_func_editor_outdent_list_item_at_selection_scalar(
942
+ ): Short
943
+ fun uniffi_editor_core_checksum_func_editor_redo(
944
+ ): Short
945
+ fun uniffi_editor_core_checksum_func_editor_replace_html(
946
+ ): Short
947
+ fun uniffi_editor_core_checksum_func_editor_replace_json(
948
+ ): Short
949
+ fun uniffi_editor_core_checksum_func_editor_replace_selection_text(
950
+ ): Short
951
+ fun uniffi_editor_core_checksum_func_editor_replace_text_scalar(
952
+ ): Short
953
+ fun uniffi_editor_core_checksum_func_editor_resize_image_at_doc_pos(
954
+ ): Short
955
+ fun uniffi_editor_core_checksum_func_editor_scalar_to_doc(
956
+ ): Short
957
+ fun uniffi_editor_core_checksum_func_editor_set_html(
958
+ ): Short
959
+ fun uniffi_editor_core_checksum_func_editor_set_json(
960
+ ): Short
961
+ fun uniffi_editor_core_checksum_func_editor_set_mark(
962
+ ): Short
963
+ fun uniffi_editor_core_checksum_func_editor_set_mark_at_selection_scalar(
964
+ ): Short
965
+ fun uniffi_editor_core_checksum_func_editor_set_selection(
966
+ ): Short
967
+ fun uniffi_editor_core_checksum_func_editor_set_selection_scalar(
968
+ ): Short
969
+ fun uniffi_editor_core_checksum_func_editor_split_block(
970
+ ): Short
971
+ fun uniffi_editor_core_checksum_func_editor_split_block_scalar(
972
+ ): Short
973
+ fun uniffi_editor_core_checksum_func_editor_toggle_blockquote(
974
+ ): Short
975
+ fun uniffi_editor_core_checksum_func_editor_toggle_blockquote_at_selection_scalar(
976
+ ): Short
977
+ fun uniffi_editor_core_checksum_func_editor_toggle_heading(
978
+ ): Short
979
+ fun uniffi_editor_core_checksum_func_editor_toggle_heading_at_selection_scalar(
980
+ ): Short
981
+ fun uniffi_editor_core_checksum_func_editor_toggle_mark(
982
+ ): Short
983
+ fun uniffi_editor_core_checksum_func_editor_toggle_mark_at_selection_scalar(
984
+ ): Short
985
+ fun uniffi_editor_core_checksum_func_editor_toggle_task_item_checked_at_selection_scalar(
986
+ ): Short
987
+ fun uniffi_editor_core_checksum_func_editor_undo(
988
+ ): Short
989
+ fun uniffi_editor_core_checksum_func_editor_unset_mark(
990
+ ): Short
991
+ fun uniffi_editor_core_checksum_func_editor_unset_mark_at_selection_scalar(
992
+ ): Short
993
+ fun uniffi_editor_core_checksum_func_editor_unwrap_from_list(
994
+ ): Short
995
+ fun uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar(
996
+ ): Short
997
+ fun uniffi_editor_core_checksum_func_editor_wrap_in_list(
998
+ ): Short
999
+ fun uniffi_editor_core_checksum_func_editor_wrap_in_list_at_selection_scalar(
1000
+ ): Short
1001
+ fun ffi_editor_core_uniffi_contract_version(
1002
+ ): Int
1003
+
1004
+ }
1005
+
1006
+ // A JNA Library to expose the extern-C FFI definitions.
1007
+ // This is an implementation detail which will be called internally by the public API.
1008
+ internal interface UniffiLib : Library {
1009
+ companion object {
1010
+ internal val INSTANCE: UniffiLib by lazy {
1011
+ val componentName = "editor_core"
1012
+ // For large crates we prevent `MethodTooLargeException` (see #2340)
1013
+ // N.B. the name of the extension is very misleading, since it is
1014
+ // rather `InterfaceTooLargeException`, caused by too many methods
1015
+ // in the interface for large crates.
1016
+ //
1017
+ // By splitting the otherwise huge interface into two parts
1018
+ // * UniffiLib (this)
1019
+ // * IntegrityCheckingUniffiLib
1020
+ // And all checksum methods are put into `IntegrityCheckingUniffiLib`
1021
+ // we allow for ~2x as many methods in the UniffiLib interface.
1022
+ //
1023
+ // Thus we first load the library with `loadIndirect` as `IntegrityCheckingUniffiLib`
1024
+ // so that we can (optionally!) call `uniffiCheckApiChecksums`...
1025
+ loadIndirect<IntegrityCheckingUniffiLib>(componentName)
1026
+ .also { lib: IntegrityCheckingUniffiLib ->
1027
+ uniffiCheckContractApiVersion(lib)
1028
+ uniffiCheckApiChecksums(lib)
1029
+ }
1030
+ // ... and then we load the library as `UniffiLib`
1031
+ // N.B. we cannot use `loadIndirect` once and then try to cast it to `UniffiLib`
1032
+ // => results in `java.lang.ClassCastException: com.sun.proxy.$Proxy cannot be cast to ...`
1033
+ // error. So we must call `loadIndirect` twice. For crates large enough
1034
+ // to trigger this issue, the performance impact is negligible, running on
1035
+ // a macOS M1 machine the `loadIndirect` call takes ~50ms.
1036
+ val lib = loadIndirect<UniffiLib>(componentName)
1037
+ // No need to check the contract version and checksums, since
1038
+ // we already did that with `IntegrityCheckingUniffiLib` above.
1039
+ // Loading of library with integrity check done.
1040
+ lib
1041
+ }
1042
+
1043
+ }
1044
+
1045
+ // FFI functions
1046
+ fun uniffi_editor_core_fn_func_collaboration_session_apply_encoded_state(`id`: Long,`encodedStateJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1047
+ ): RustBuffer.ByValue
1048
+ fun uniffi_editor_core_fn_func_collaboration_session_apply_local_document_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1049
+ ): RustBuffer.ByValue
1050
+ fun uniffi_editor_core_fn_func_collaboration_session_clear_local_awareness(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1051
+ ): RustBuffer.ByValue
1052
+ fun uniffi_editor_core_fn_func_collaboration_session_create(`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1053
+ ): Long
1054
+ fun uniffi_editor_core_fn_func_collaboration_session_destroy(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1055
+ ): Unit
1056
+ fun uniffi_editor_core_fn_func_collaboration_session_get_document_json(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1057
+ ): RustBuffer.ByValue
1058
+ fun uniffi_editor_core_fn_func_collaboration_session_get_encoded_state(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1059
+ ): RustBuffer.ByValue
1060
+ fun uniffi_editor_core_fn_func_collaboration_session_get_peers_json(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1061
+ ): RustBuffer.ByValue
1062
+ fun uniffi_editor_core_fn_func_collaboration_session_handle_message(`id`: Long,`messageJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1063
+ ): RustBuffer.ByValue
1064
+ fun uniffi_editor_core_fn_func_collaboration_session_replace_encoded_state(`id`: Long,`encodedStateJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1065
+ ): RustBuffer.ByValue
1066
+ fun uniffi_editor_core_fn_func_collaboration_session_set_local_awareness(`id`: Long,`awarenessJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1067
+ ): RustBuffer.ByValue
1068
+ fun uniffi_editor_core_fn_func_collaboration_session_start(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1069
+ ): RustBuffer.ByValue
1070
+ fun uniffi_editor_core_fn_func_editor_can_redo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1071
+ ): Byte
1072
+ fun uniffi_editor_core_fn_func_editor_can_undo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1073
+ ): Byte
1074
+ fun uniffi_editor_core_fn_func_editor_core_version(uniffi_out_err: UniffiRustCallStatus,
1075
+ ): RustBuffer.ByValue
1076
+ fun uniffi_editor_core_fn_func_editor_create(`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1077
+ ): Long
1078
+ fun uniffi_editor_core_fn_func_editor_delete_and_split_scalar(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,uniffi_out_err: UniffiRustCallStatus,
1079
+ ): RustBuffer.ByValue
1080
+ fun uniffi_editor_core_fn_func_editor_delete_backward_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1081
+ ): RustBuffer.ByValue
1082
+ fun uniffi_editor_core_fn_func_editor_delete_range(`id`: Long,`from`: Int,`to`: Int,uniffi_out_err: UniffiRustCallStatus,
1083
+ ): RustBuffer.ByValue
1084
+ fun uniffi_editor_core_fn_func_editor_delete_scalar_range(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,uniffi_out_err: UniffiRustCallStatus,
1085
+ ): RustBuffer.ByValue
1086
+ fun uniffi_editor_core_fn_func_editor_destroy(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1087
+ ): Unit
1088
+ fun uniffi_editor_core_fn_func_editor_doc_to_scalar(`id`: Long,`docPos`: Int,uniffi_out_err: UniffiRustCallStatus,
1089
+ ): Int
1090
+ fun uniffi_editor_core_fn_func_editor_get_content_snapshot(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1091
+ ): RustBuffer.ByValue
1092
+ fun uniffi_editor_core_fn_func_editor_get_current_state(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1093
+ ): RustBuffer.ByValue
1094
+ fun uniffi_editor_core_fn_func_editor_get_html(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1095
+ ): RustBuffer.ByValue
1096
+ fun uniffi_editor_core_fn_func_editor_get_json(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1097
+ ): RustBuffer.ByValue
1098
+ fun uniffi_editor_core_fn_func_editor_get_selection(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1099
+ ): RustBuffer.ByValue
1100
+ fun uniffi_editor_core_fn_func_editor_get_selection_state(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1101
+ ): RustBuffer.ByValue
1102
+ fun uniffi_editor_core_fn_func_editor_indent_list_item(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1103
+ ): RustBuffer.ByValue
1104
+ fun uniffi_editor_core_fn_func_editor_indent_list_item_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1105
+ ): RustBuffer.ByValue
1106
+ fun uniffi_editor_core_fn_func_editor_insert_content_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1107
+ ): RustBuffer.ByValue
1108
+ fun uniffi_editor_core_fn_func_editor_insert_content_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1109
+ ): RustBuffer.ByValue
1110
+ fun uniffi_editor_core_fn_func_editor_insert_content_json_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1111
+ ): RustBuffer.ByValue
1112
+ fun uniffi_editor_core_fn_func_editor_insert_node(`id`: Long,`nodeType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1113
+ ): RustBuffer.ByValue
1114
+ fun uniffi_editor_core_fn_func_editor_insert_node_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`nodeType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1115
+ ): RustBuffer.ByValue
1116
+ fun uniffi_editor_core_fn_func_editor_insert_text(`id`: Long,`pos`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1117
+ ): RustBuffer.ByValue
1118
+ fun uniffi_editor_core_fn_func_editor_insert_text_scalar(`id`: Long,`scalarPos`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1119
+ ): RustBuffer.ByValue
1120
+ fun uniffi_editor_core_fn_func_editor_outdent_list_item(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1121
+ ): RustBuffer.ByValue
1122
+ fun uniffi_editor_core_fn_func_editor_outdent_list_item_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1123
+ ): RustBuffer.ByValue
1124
+ fun uniffi_editor_core_fn_func_editor_redo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1125
+ ): RustBuffer.ByValue
1126
+ fun uniffi_editor_core_fn_func_editor_replace_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1127
+ ): RustBuffer.ByValue
1128
+ fun uniffi_editor_core_fn_func_editor_replace_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1129
+ ): RustBuffer.ByValue
1130
+ fun uniffi_editor_core_fn_func_editor_replace_selection_text(`id`: Long,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1131
+ ): RustBuffer.ByValue
1132
+ fun uniffi_editor_core_fn_func_editor_replace_text_scalar(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1133
+ ): RustBuffer.ByValue
1134
+ fun uniffi_editor_core_fn_func_editor_resize_image_at_doc_pos(`id`: Long,`docPos`: Int,`width`: Int,`height`: Int,uniffi_out_err: UniffiRustCallStatus,
1135
+ ): RustBuffer.ByValue
1136
+ fun uniffi_editor_core_fn_func_editor_scalar_to_doc(`id`: Long,`scalar`: Int,uniffi_out_err: UniffiRustCallStatus,
1137
+ ): Int
1138
+ fun uniffi_editor_core_fn_func_editor_set_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1139
+ ): RustBuffer.ByValue
1140
+ fun uniffi_editor_core_fn_func_editor_set_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1141
+ ): RustBuffer.ByValue
1142
+ fun uniffi_editor_core_fn_func_editor_set_mark(`id`: Long,`markName`: RustBuffer.ByValue,`attrsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1143
+ ): RustBuffer.ByValue
1144
+ fun uniffi_editor_core_fn_func_editor_set_mark_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`markName`: RustBuffer.ByValue,`attrsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1145
+ ): RustBuffer.ByValue
1146
+ fun uniffi_editor_core_fn_func_editor_set_selection(`id`: Long,`anchor`: Int,`head`: Int,uniffi_out_err: UniffiRustCallStatus,
1147
+ ): Unit
1148
+ fun uniffi_editor_core_fn_func_editor_set_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1149
+ ): Unit
1150
+ fun uniffi_editor_core_fn_func_editor_split_block(`id`: Long,`pos`: Int,uniffi_out_err: UniffiRustCallStatus,
1151
+ ): RustBuffer.ByValue
1152
+ fun uniffi_editor_core_fn_func_editor_split_block_scalar(`id`: Long,`scalarPos`: Int,uniffi_out_err: UniffiRustCallStatus,
1153
+ ): RustBuffer.ByValue
1154
+ fun uniffi_editor_core_fn_func_editor_toggle_blockquote(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1155
+ ): RustBuffer.ByValue
1156
+ fun uniffi_editor_core_fn_func_editor_toggle_blockquote_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1157
+ ): RustBuffer.ByValue
1158
+ fun uniffi_editor_core_fn_func_editor_toggle_heading(`id`: Long,`level`: Byte,uniffi_out_err: UniffiRustCallStatus,
1159
+ ): RustBuffer.ByValue
1160
+ fun uniffi_editor_core_fn_func_editor_toggle_heading_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`level`: Byte,uniffi_out_err: UniffiRustCallStatus,
1161
+ ): RustBuffer.ByValue
1162
+ fun uniffi_editor_core_fn_func_editor_toggle_mark(`id`: Long,`markName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1163
+ ): RustBuffer.ByValue
1164
+ fun uniffi_editor_core_fn_func_editor_toggle_mark_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`markName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1165
+ ): RustBuffer.ByValue
1166
+ fun uniffi_editor_core_fn_func_editor_toggle_task_item_checked_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1167
+ ): RustBuffer.ByValue
1168
+ fun uniffi_editor_core_fn_func_editor_undo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1169
+ ): RustBuffer.ByValue
1170
+ fun uniffi_editor_core_fn_func_editor_unset_mark(`id`: Long,`markName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1171
+ ): RustBuffer.ByValue
1172
+ fun uniffi_editor_core_fn_func_editor_unset_mark_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`markName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1173
+ ): RustBuffer.ByValue
1174
+ fun uniffi_editor_core_fn_func_editor_unwrap_from_list(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
1175
+ ): RustBuffer.ByValue
1176
+ fun uniffi_editor_core_fn_func_editor_unwrap_from_list_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
1177
+ ): RustBuffer.ByValue
1178
+ fun uniffi_editor_core_fn_func_editor_wrap_in_list(`id`: Long,`listType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1179
+ ): RustBuffer.ByValue
1180
+ fun uniffi_editor_core_fn_func_editor_wrap_in_list_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,`listType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1181
+ ): RustBuffer.ByValue
1182
+ fun ffi_editor_core_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
1183
+ ): RustBuffer.ByValue
1184
+ fun ffi_editor_core_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
1185
+ ): RustBuffer.ByValue
1186
+ fun ffi_editor_core_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1187
+ ): Unit
1188
+ fun ffi_editor_core_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
1189
+ ): RustBuffer.ByValue
1190
+ fun ffi_editor_core_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1191
+ ): Unit
1192
+ fun ffi_editor_core_rust_future_cancel_u8(`handle`: Long,
1193
+ ): Unit
1194
+ fun ffi_editor_core_rust_future_free_u8(`handle`: Long,
1195
+ ): Unit
1196
+ fun ffi_editor_core_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1197
+ ): Byte
1198
+ fun ffi_editor_core_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1199
+ ): Unit
1200
+ fun ffi_editor_core_rust_future_cancel_i8(`handle`: Long,
1201
+ ): Unit
1202
+ fun ffi_editor_core_rust_future_free_i8(`handle`: Long,
1203
+ ): Unit
1204
+ fun ffi_editor_core_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1205
+ ): Byte
1206
+ fun ffi_editor_core_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1207
+ ): Unit
1208
+ fun ffi_editor_core_rust_future_cancel_u16(`handle`: Long,
1209
+ ): Unit
1210
+ fun ffi_editor_core_rust_future_free_u16(`handle`: Long,
1211
+ ): Unit
1212
+ fun ffi_editor_core_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1213
+ ): Short
1214
+ fun ffi_editor_core_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1215
+ ): Unit
1216
+ fun ffi_editor_core_rust_future_cancel_i16(`handle`: Long,
1217
+ ): Unit
1218
+ fun ffi_editor_core_rust_future_free_i16(`handle`: Long,
1219
+ ): Unit
1220
+ fun ffi_editor_core_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1221
+ ): Short
1222
+ fun ffi_editor_core_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1223
+ ): Unit
1224
+ fun ffi_editor_core_rust_future_cancel_u32(`handle`: Long,
1225
+ ): Unit
1226
+ fun ffi_editor_core_rust_future_free_u32(`handle`: Long,
1227
+ ): Unit
1228
+ fun ffi_editor_core_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1229
+ ): Int
1230
+ fun ffi_editor_core_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1231
+ ): Unit
1232
+ fun ffi_editor_core_rust_future_cancel_i32(`handle`: Long,
1233
+ ): Unit
1234
+ fun ffi_editor_core_rust_future_free_i32(`handle`: Long,
1235
+ ): Unit
1236
+ fun ffi_editor_core_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1237
+ ): Int
1238
+ fun ffi_editor_core_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1239
+ ): Unit
1240
+ fun ffi_editor_core_rust_future_cancel_u64(`handle`: Long,
1241
+ ): Unit
1242
+ fun ffi_editor_core_rust_future_free_u64(`handle`: Long,
1243
+ ): Unit
1244
+ fun ffi_editor_core_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1245
+ ): Long
1246
+ fun ffi_editor_core_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1247
+ ): Unit
1248
+ fun ffi_editor_core_rust_future_cancel_i64(`handle`: Long,
1249
+ ): Unit
1250
+ fun ffi_editor_core_rust_future_free_i64(`handle`: Long,
1251
+ ): Unit
1252
+ fun ffi_editor_core_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1253
+ ): Long
1254
+ fun ffi_editor_core_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1255
+ ): Unit
1256
+ fun ffi_editor_core_rust_future_cancel_f32(`handle`: Long,
1257
+ ): Unit
1258
+ fun ffi_editor_core_rust_future_free_f32(`handle`: Long,
1259
+ ): Unit
1260
+ fun ffi_editor_core_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1261
+ ): Float
1262
+ fun ffi_editor_core_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1263
+ ): Unit
1264
+ fun ffi_editor_core_rust_future_cancel_f64(`handle`: Long,
1265
+ ): Unit
1266
+ fun ffi_editor_core_rust_future_free_f64(`handle`: Long,
1267
+ ): Unit
1268
+ fun ffi_editor_core_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1269
+ ): Double
1270
+ fun ffi_editor_core_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1271
+ ): Unit
1272
+ fun ffi_editor_core_rust_future_cancel_pointer(`handle`: Long,
1273
+ ): Unit
1274
+ fun ffi_editor_core_rust_future_free_pointer(`handle`: Long,
1275
+ ): Unit
1276
+ fun ffi_editor_core_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1277
+ ): Pointer
1278
+ fun ffi_editor_core_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1279
+ ): Unit
1280
+ fun ffi_editor_core_rust_future_cancel_rust_buffer(`handle`: Long,
1281
+ ): Unit
1282
+ fun ffi_editor_core_rust_future_free_rust_buffer(`handle`: Long,
1283
+ ): Unit
1284
+ fun ffi_editor_core_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1285
+ ): RustBuffer.ByValue
1286
+ fun ffi_editor_core_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1287
+ ): Unit
1288
+ fun ffi_editor_core_rust_future_cancel_void(`handle`: Long,
1289
+ ): Unit
1290
+ fun ffi_editor_core_rust_future_free_void(`handle`: Long,
1291
+ ): Unit
1292
+ fun ffi_editor_core_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1293
+ ): Unit
1294
+
1295
+ }
1296
+
1297
+ private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
1298
+ // Get the bindings contract version from our ComponentInterface
1299
+ val bindings_contract_version = 29
1300
+ // Get the scaffolding contract version by calling the into the dylib
1301
+ val scaffolding_contract_version = lib.ffi_editor_core_uniffi_contract_version()
1302
+ if (bindings_contract_version != scaffolding_contract_version) {
1303
+ throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
1304
+ }
1305
+ }
1306
+ @Suppress("UNUSED_PARAMETER")
1307
+ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
1308
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_apply_encoded_state() != 4684.toShort()) {
1309
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1310
+ }
1311
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_apply_local_document_json() != 396.toShort()) {
1312
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1313
+ }
1314
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_clear_local_awareness() != 48044.toShort()) {
1315
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1316
+ }
1317
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_create() != 60237.toShort()) {
1318
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1319
+ }
1320
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_destroy() != 56261.toShort()) {
1321
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1322
+ }
1323
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_get_document_json() != 44139.toShort()) {
1324
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1325
+ }
1326
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_get_encoded_state() != 16895.toShort()) {
1327
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1328
+ }
1329
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_get_peers_json() != 46461.toShort()) {
1330
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1331
+ }
1332
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_handle_message() != 25528.toShort()) {
1333
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1334
+ }
1335
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_replace_encoded_state() != 53994.toShort()) {
1336
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1337
+ }
1338
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_set_local_awareness() != 63617.toShort()) {
1339
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1340
+ }
1341
+ if (lib.uniffi_editor_core_checksum_func_collaboration_session_start() != 54751.toShort()) {
1342
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1343
+ }
1344
+ if (lib.uniffi_editor_core_checksum_func_editor_can_redo() != 15854.toShort()) {
1345
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1346
+ }
1347
+ if (lib.uniffi_editor_core_checksum_func_editor_can_undo() != 52062.toShort()) {
1348
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1349
+ }
1350
+ if (lib.uniffi_editor_core_checksum_func_editor_core_version() != 41638.toShort()) {
1351
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1352
+ }
1353
+ if (lib.uniffi_editor_core_checksum_func_editor_create() != 19812.toShort()) {
1354
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1355
+ }
1356
+ if (lib.uniffi_editor_core_checksum_func_editor_delete_and_split_scalar() != 13764.toShort()) {
1357
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1358
+ }
1359
+ if (lib.uniffi_editor_core_checksum_func_editor_delete_backward_at_selection_scalar() != 7697.toShort()) {
1360
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1361
+ }
1362
+ if (lib.uniffi_editor_core_checksum_func_editor_delete_range() != 6109.toShort()) {
1363
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1364
+ }
1365
+ if (lib.uniffi_editor_core_checksum_func_editor_delete_scalar_range() != 60098.toShort()) {
1366
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1367
+ }
1368
+ if (lib.uniffi_editor_core_checksum_func_editor_destroy() != 35774.toShort()) {
1369
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1370
+ }
1371
+ if (lib.uniffi_editor_core_checksum_func_editor_doc_to_scalar() != 48291.toShort()) {
1372
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1373
+ }
1374
+ if (lib.uniffi_editor_core_checksum_func_editor_get_content_snapshot() != 32837.toShort()) {
1375
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1376
+ }
1377
+ if (lib.uniffi_editor_core_checksum_func_editor_get_current_state() != 13946.toShort()) {
1378
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1379
+ }
1380
+ if (lib.uniffi_editor_core_checksum_func_editor_get_html() != 28868.toShort()) {
1381
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1382
+ }
1383
+ if (lib.uniffi_editor_core_checksum_func_editor_get_json() != 8212.toShort()) {
1384
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1385
+ }
1386
+ if (lib.uniffi_editor_core_checksum_func_editor_get_selection() != 20571.toShort()) {
1387
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1388
+ }
1389
+ if (lib.uniffi_editor_core_checksum_func_editor_get_selection_state() != 16471.toShort()) {
1390
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1391
+ }
1392
+ if (lib.uniffi_editor_core_checksum_func_editor_indent_list_item() != 10818.toShort()) {
1393
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1394
+ }
1395
+ if (lib.uniffi_editor_core_checksum_func_editor_indent_list_item_at_selection_scalar() != 13664.toShort()) {
1396
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1397
+ }
1398
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_content_html() != 62700.toShort()) {
1399
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1400
+ }
1401
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_content_json() != 56904.toShort()) {
1402
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1403
+ }
1404
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_content_json_at_selection_scalar() != 51362.toShort()) {
1405
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1406
+ }
1407
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_node() != 22371.toShort()) {
1408
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1409
+ }
1410
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_node_at_selection_scalar() != 32254.toShort()) {
1411
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1412
+ }
1413
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_text() != 22584.toShort()) {
1414
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1415
+ }
1416
+ if (lib.uniffi_editor_core_checksum_func_editor_insert_text_scalar() != 30263.toShort()) {
1417
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1418
+ }
1419
+ if (lib.uniffi_editor_core_checksum_func_editor_outdent_list_item() != 55796.toShort()) {
1420
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1421
+ }
1422
+ if (lib.uniffi_editor_core_checksum_func_editor_outdent_list_item_at_selection_scalar() != 32672.toShort()) {
1423
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1424
+ }
1425
+ if (lib.uniffi_editor_core_checksum_func_editor_redo() != 26508.toShort()) {
1426
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1427
+ }
1428
+ if (lib.uniffi_editor_core_checksum_func_editor_replace_html() != 41778.toShort()) {
1429
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1430
+ }
1431
+ if (lib.uniffi_editor_core_checksum_func_editor_replace_json() != 28738.toShort()) {
1432
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1433
+ }
1434
+ if (lib.uniffi_editor_core_checksum_func_editor_replace_selection_text() != 11138.toShort()) {
1435
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1436
+ }
1437
+ if (lib.uniffi_editor_core_checksum_func_editor_replace_text_scalar() != 45475.toShort()) {
1438
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1439
+ }
1440
+ if (lib.uniffi_editor_core_checksum_func_editor_resize_image_at_doc_pos() != 36353.toShort()) {
1441
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1442
+ }
1443
+ if (lib.uniffi_editor_core_checksum_func_editor_scalar_to_doc() != 40126.toShort()) {
1444
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1445
+ }
1446
+ if (lib.uniffi_editor_core_checksum_func_editor_set_html() != 11045.toShort()) {
1447
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1448
+ }
1449
+ if (lib.uniffi_editor_core_checksum_func_editor_set_json() != 18497.toShort()) {
1450
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1451
+ }
1452
+ if (lib.uniffi_editor_core_checksum_func_editor_set_mark() != 29349.toShort()) {
1453
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1454
+ }
1455
+ if (lib.uniffi_editor_core_checksum_func_editor_set_mark_at_selection_scalar() != 43994.toShort()) {
1456
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1457
+ }
1458
+ if (lib.uniffi_editor_core_checksum_func_editor_set_selection() != 28236.toShort()) {
1459
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1460
+ }
1461
+ if (lib.uniffi_editor_core_checksum_func_editor_set_selection_scalar() != 16443.toShort()) {
1462
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1463
+ }
1464
+ if (lib.uniffi_editor_core_checksum_func_editor_split_block() != 52038.toShort()) {
1465
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1466
+ }
1467
+ if (lib.uniffi_editor_core_checksum_func_editor_split_block_scalar() != 47554.toShort()) {
1468
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1469
+ }
1470
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_blockquote() != 25804.toShort()) {
1471
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1472
+ }
1473
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_blockquote_at_selection_scalar() != 58523.toShort()) {
1474
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1475
+ }
1476
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_heading() != 7099.toShort()) {
1477
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1478
+ }
1479
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_heading_at_selection_scalar() != 54315.toShort()) {
1480
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1481
+ }
1482
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_mark() != 30661.toShort()) {
1483
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1484
+ }
1485
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_mark_at_selection_scalar() != 61751.toShort()) {
1486
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1487
+ }
1488
+ if (lib.uniffi_editor_core_checksum_func_editor_toggle_task_item_checked_at_selection_scalar() != 1217.toShort()) {
1489
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1490
+ }
1491
+ if (lib.uniffi_editor_core_checksum_func_editor_undo() != 28689.toShort()) {
1492
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1493
+ }
1494
+ if (lib.uniffi_editor_core_checksum_func_editor_unset_mark() != 47985.toShort()) {
1495
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1496
+ }
1497
+ if (lib.uniffi_editor_core_checksum_func_editor_unset_mark_at_selection_scalar() != 54992.toShort()) {
1498
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1499
+ }
1500
+ if (lib.uniffi_editor_core_checksum_func_editor_unwrap_from_list() != 41875.toShort()) {
1501
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1502
+ }
1503
+ if (lib.uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar() != 57899.toShort()) {
1504
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1505
+ }
1506
+ if (lib.uniffi_editor_core_checksum_func_editor_wrap_in_list() != 32846.toShort()) {
1507
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1508
+ }
1509
+ if (lib.uniffi_editor_core_checksum_func_editor_wrap_in_list_at_selection_scalar() != 6459.toShort()) {
1510
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1511
+ }
1512
+ }
1513
+
1514
+ /**
1515
+ * @suppress
1516
+ */
1517
+ public fun uniffiEnsureInitialized() {
1518
+ UniffiLib.INSTANCE
1519
+ }
1520
+
1521
+ // Async support
1522
+
1523
+ // Public interface members begin here.
1524
+
1525
+
1526
+ // Interface implemented by anything that can contain an object reference.
1527
+ //
1528
+ // Such types expose a `destroy()` method that must be called to cleanly
1529
+ // dispose of the contained objects. Failure to call this method may result
1530
+ // in memory leaks.
1531
+ //
1532
+ // The easiest way to ensure this method is called is to use the `.use`
1533
+ // helper method to execute a block and destroy the object at the end.
1534
+ interface Disposable {
1535
+ fun destroy()
1536
+ companion object {
1537
+ fun destroy(vararg args: Any?) {
1538
+ for (arg in args) {
1539
+ when (arg) {
1540
+ is Disposable -> arg.destroy()
1541
+ is ArrayList<*> -> {
1542
+ for (idx in arg.indices) {
1543
+ val element = arg[idx]
1544
+ if (element is Disposable) {
1545
+ element.destroy()
1546
+ }
1547
+ }
1548
+ }
1549
+ is Map<*, *> -> {
1550
+ for (element in arg.values) {
1551
+ if (element is Disposable) {
1552
+ element.destroy()
1553
+ }
1554
+ }
1555
+ }
1556
+ is Iterable<*> -> {
1557
+ for (element in arg) {
1558
+ if (element is Disposable) {
1559
+ element.destroy()
1560
+ }
1561
+ }
1562
+ }
1563
+ }
1564
+ }
1565
+ }
1566
+ }
1567
+ }
1568
+
1569
+ /**
1570
+ * @suppress
1571
+ */
1572
+ inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
1573
+ try {
1574
+ block(this)
1575
+ } finally {
1576
+ try {
1577
+ // N.B. our implementation is on the nullable type `Disposable?`.
1578
+ this?.destroy()
1579
+ } catch (e: Throwable) {
1580
+ // swallow
1581
+ }
1582
+ }
1583
+
1584
+ /**
1585
+ * Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
1586
+ *
1587
+ * @suppress
1588
+ * */
1589
+ object NoPointer
1590
+
1591
+ /**
1592
+ * @suppress
1593
+ */
1594
+ public object FfiConverterUByte: FfiConverter<UByte, Byte> {
1595
+ override fun lift(value: Byte): UByte {
1596
+ return value.toUByte()
1597
+ }
1598
+
1599
+ override fun read(buf: ByteBuffer): UByte {
1600
+ return lift(buf.get())
1601
+ }
1602
+
1603
+ override fun lower(value: UByte): Byte {
1604
+ return value.toByte()
1605
+ }
1606
+
1607
+ override fun allocationSize(value: UByte) = 1UL
1608
+
1609
+ override fun write(value: UByte, buf: ByteBuffer) {
1610
+ buf.put(value.toByte())
1611
+ }
1612
+ }
1613
+
1614
+ /**
1615
+ * @suppress
1616
+ */
1617
+ public object FfiConverterUInt: FfiConverter<UInt, Int> {
1618
+ override fun lift(value: Int): UInt {
1619
+ return value.toUInt()
1620
+ }
1621
+
1622
+ override fun read(buf: ByteBuffer): UInt {
1623
+ return lift(buf.getInt())
1624
+ }
1625
+
1626
+ override fun lower(value: UInt): Int {
1627
+ return value.toInt()
1628
+ }
1629
+
1630
+ override fun allocationSize(value: UInt) = 4UL
1631
+
1632
+ override fun write(value: UInt, buf: ByteBuffer) {
1633
+ buf.putInt(value.toInt())
1634
+ }
1635
+ }
1636
+
1637
+ /**
1638
+ * @suppress
1639
+ */
1640
+ public object FfiConverterULong: FfiConverter<ULong, Long> {
1641
+ override fun lift(value: Long): ULong {
1642
+ return value.toULong()
1643
+ }
1644
+
1645
+ override fun read(buf: ByteBuffer): ULong {
1646
+ return lift(buf.getLong())
1647
+ }
1648
+
1649
+ override fun lower(value: ULong): Long {
1650
+ return value.toLong()
1651
+ }
1652
+
1653
+ override fun allocationSize(value: ULong) = 8UL
1654
+
1655
+ override fun write(value: ULong, buf: ByteBuffer) {
1656
+ buf.putLong(value.toLong())
1657
+ }
1658
+ }
1659
+
1660
+ /**
1661
+ * @suppress
1662
+ */
1663
+ public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
1664
+ override fun lift(value: Byte): Boolean {
1665
+ return value.toInt() != 0
1666
+ }
1667
+
1668
+ override fun read(buf: ByteBuffer): Boolean {
1669
+ return lift(buf.get())
1670
+ }
1671
+
1672
+ override fun lower(value: Boolean): Byte {
1673
+ return if (value) 1.toByte() else 0.toByte()
1674
+ }
1675
+
1676
+ override fun allocationSize(value: Boolean) = 1UL
1677
+
1678
+ override fun write(value: Boolean, buf: ByteBuffer) {
1679
+ buf.put(lower(value))
1680
+ }
1681
+ }
1682
+
1683
+ /**
1684
+ * @suppress
1685
+ */
1686
+ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
1687
+ // Note: we don't inherit from FfiConverterRustBuffer, because we use a
1688
+ // special encoding when lowering/lifting. We can use `RustBuffer.len` to
1689
+ // store our length and avoid writing it out to the buffer.
1690
+ override fun lift(value: RustBuffer.ByValue): String {
1691
+ try {
1692
+ val byteArr = ByteArray(value.len.toInt())
1693
+ value.asByteBuffer()!!.get(byteArr)
1694
+ return byteArr.toString(Charsets.UTF_8)
1695
+ } finally {
1696
+ RustBuffer.free(value)
1697
+ }
1698
+ }
1699
+
1700
+ override fun read(buf: ByteBuffer): String {
1701
+ val len = buf.getInt()
1702
+ val byteArr = ByteArray(len)
1703
+ buf.get(byteArr)
1704
+ return byteArr.toString(Charsets.UTF_8)
1705
+ }
1706
+
1707
+ fun toUtf8(value: String): ByteBuffer {
1708
+ // Make sure we don't have invalid UTF-16, check for lone surrogates.
1709
+ return Charsets.UTF_8.newEncoder().run {
1710
+ onMalformedInput(CodingErrorAction.REPORT)
1711
+ encode(CharBuffer.wrap(value))
1712
+ }
1713
+ }
1714
+
1715
+ override fun lower(value: String): RustBuffer.ByValue {
1716
+ val byteBuf = toUtf8(value)
1717
+ // Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
1718
+ // to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
1719
+ val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
1720
+ rbuf.asByteBuffer()!!.put(byteBuf)
1721
+ return rbuf
1722
+ }
1723
+
1724
+ // We aren't sure exactly how many bytes our string will be once it's UTF-8
1725
+ // encoded. Allocate 3 bytes per UTF-16 code unit which will always be
1726
+ // enough.
1727
+ override fun allocationSize(value: String): ULong {
1728
+ val sizeForLength = 4UL
1729
+ val sizeForString = value.length.toULong() * 3UL
1730
+ return sizeForLength + sizeForString
1731
+ }
1732
+
1733
+ override fun write(value: String, buf: ByteBuffer) {
1734
+ val byteBuf = toUtf8(value)
1735
+ buf.putInt(byteBuf.limit())
1736
+ buf.put(byteBuf)
1737
+ }
1738
+ }
1739
+ /**
1740
+ * Apply a durable Yjs encoded state/update represented as a JSON byte array.
1741
+ */ fun `collaborationSessionApplyEncodedState`(`id`: kotlin.ULong, `encodedStateJson`: kotlin.String): kotlin.String {
1742
+ return FfiConverterString.lift(
1743
+ uniffiRustCall() { _status ->
1744
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_apply_encoded_state(
1745
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`encodedStateJson`),_status)
1746
+ }
1747
+ )
1748
+ }
1749
+
1750
+
1751
+ /**
1752
+ * Apply a local ProseMirror JSON snapshot to the collaboration session.
1753
+ */ fun `collaborationSessionApplyLocalDocumentJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
1754
+ return FfiConverterString.lift(
1755
+ uniffiRustCall() { _status ->
1756
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_apply_local_document_json(
1757
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
1758
+ }
1759
+ )
1760
+ }
1761
+
1762
+
1763
+ /**
1764
+ * Clear the local awareness payload for a collaboration session.
1765
+ */ fun `collaborationSessionClearLocalAwareness`(`id`: kotlin.ULong): kotlin.String {
1766
+ return FfiConverterString.lift(
1767
+ uniffiRustCall() { _status ->
1768
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_clear_local_awareness(
1769
+ FfiConverterULong.lower(`id`),_status)
1770
+ }
1771
+ )
1772
+ }
1773
+
1774
+
1775
+ /**
1776
+ * Create a Yjs collaboration session backed by yrs.
1777
+ */ fun `collaborationSessionCreate`(`configJson`: kotlin.String): kotlin.ULong {
1778
+ return FfiConverterULong.lift(
1779
+ uniffiRustCall() { _status ->
1780
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_create(
1781
+ FfiConverterString.lower(`configJson`),_status)
1782
+ }
1783
+ )
1784
+ }
1785
+
1786
+
1787
+ /**
1788
+ * Destroy a collaboration session and free its resources.
1789
+ */ fun `collaborationSessionDestroy`(`id`: kotlin.ULong)
1790
+ =
1791
+ uniffiRustCall() { _status ->
1792
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_destroy(
1793
+ FfiConverterULong.lower(`id`),_status)
1794
+ }
1795
+
1796
+
1797
+
1798
+ /**
1799
+ * Return the current shared ProseMirror JSON document for a collaboration session.
1800
+ */ fun `collaborationSessionGetDocumentJson`(`id`: kotlin.ULong): kotlin.String {
1801
+ return FfiConverterString.lift(
1802
+ uniffiRustCall() { _status ->
1803
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_get_document_json(
1804
+ FfiConverterULong.lower(`id`),_status)
1805
+ }
1806
+ )
1807
+ }
1808
+
1809
+
1810
+ /**
1811
+ * Return the current shared Yjs document state as a JSON byte array.
1812
+ */ fun `collaborationSessionGetEncodedState`(`id`: kotlin.ULong): kotlin.String {
1813
+ return FfiConverterString.lift(
1814
+ uniffiRustCall() { _status ->
1815
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_get_encoded_state(
1816
+ FfiConverterULong.lower(`id`),_status)
1817
+ }
1818
+ )
1819
+ }
1820
+
1821
+
1822
+ /**
1823
+ * Return the current awareness peers for a collaboration session.
1824
+ */ fun `collaborationSessionGetPeersJson`(`id`: kotlin.ULong): kotlin.String {
1825
+ return FfiConverterString.lift(
1826
+ uniffiRustCall() { _status ->
1827
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_get_peers_json(
1828
+ FfiConverterULong.lower(`id`),_status)
1829
+ }
1830
+ )
1831
+ }
1832
+
1833
+
1834
+ /**
1835
+ * Apply an incoming y-sync binary message encoded as a JSON byte array.
1836
+ */ fun `collaborationSessionHandleMessage`(`id`: kotlin.ULong, `messageJson`: kotlin.String): kotlin.String {
1837
+ return FfiConverterString.lift(
1838
+ uniffiRustCall() { _status ->
1839
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_handle_message(
1840
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`messageJson`),_status)
1841
+ }
1842
+ )
1843
+ }
1844
+
1845
+
1846
+ /**
1847
+ * Replace the collaboration document with a durable Yjs encoded state/update.
1848
+ */ fun `collaborationSessionReplaceEncodedState`(`id`: kotlin.ULong, `encodedStateJson`: kotlin.String): kotlin.String {
1849
+ return FfiConverterString.lift(
1850
+ uniffiRustCall() { _status ->
1851
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_replace_encoded_state(
1852
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`encodedStateJson`),_status)
1853
+ }
1854
+ )
1855
+ }
1856
+
1857
+
1858
+ /**
1859
+ * Update the local awareness payload for a collaboration session.
1860
+ */ fun `collaborationSessionSetLocalAwareness`(`id`: kotlin.ULong, `awarenessJson`: kotlin.String): kotlin.String {
1861
+ return FfiConverterString.lift(
1862
+ uniffiRustCall() { _status ->
1863
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_set_local_awareness(
1864
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`awarenessJson`),_status)
1865
+ }
1866
+ )
1867
+ }
1868
+
1869
+
1870
+ /**
1871
+ * Start the sync handshake for a collaboration session.
1872
+ */ fun `collaborationSessionStart`(`id`: kotlin.ULong): kotlin.String {
1873
+ return FfiConverterString.lift(
1874
+ uniffiRustCall() { _status ->
1875
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_collaboration_session_start(
1876
+ FfiConverterULong.lower(`id`),_status)
1877
+ }
1878
+ )
1879
+ }
1880
+
1881
+
1882
+ /**
1883
+ * Check if redo is available.
1884
+ */ fun `editorCanRedo`(`id`: kotlin.ULong): kotlin.Boolean {
1885
+ return FfiConverterBoolean.lift(
1886
+ uniffiRustCall() { _status ->
1887
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_can_redo(
1888
+ FfiConverterULong.lower(`id`),_status)
1889
+ }
1890
+ )
1891
+ }
1892
+
1893
+
1894
+ /**
1895
+ * Check if undo is available.
1896
+ */ fun `editorCanUndo`(`id`: kotlin.ULong): kotlin.Boolean {
1897
+ return FfiConverterBoolean.lift(
1898
+ uniffiRustCall() { _status ->
1899
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_can_undo(
1900
+ FfiConverterULong.lower(`id`),_status)
1901
+ }
1902
+ )
1903
+ }
1904
+
1905
+
1906
+ /**
1907
+ * Return the crate version string.
1908
+ */ fun `editorCoreVersion`(): kotlin.String {
1909
+ return FfiConverterString.lift(
1910
+ uniffiRustCall() { _status ->
1911
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_core_version(
1912
+ _status)
1913
+ }
1914
+ )
1915
+ }
1916
+
1917
+
1918
+ /**
1919
+ * Create a new editor from a JSON config object.
1920
+ *
1921
+ * Config fields (all optional):
1922
+ * - `"schema"`: custom schema definition (see `Schema::from_json`)
1923
+ * - `"maxLength"`: maximum document length in characters
1924
+ * - `"readOnly"`: if `true`, rejects non-API mutations
1925
+ * - `"inputFilter"`: regex pattern; only matching characters are inserted
1926
+ * - `"allowBase64Images"`: if `true`, parses `<img src="data:image/...">` as image nodes
1927
+ *
1928
+ * An empty object creates a default editor.
1929
+ * Falls back to the default Tiptap schema when `"schema"` is absent or invalid.
1930
+ */ fun `editorCreate`(`configJson`: kotlin.String): kotlin.ULong {
1931
+ return FfiConverterULong.lift(
1932
+ uniffiRustCall() { _status ->
1933
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_create(
1934
+ FfiConverterString.lower(`configJson`),_status)
1935
+ }
1936
+ )
1937
+ }
1938
+
1939
+
1940
+ /**
1941
+ * Delete a scalar range then split the block (Enter with selection). Returns an update.
1942
+ */ fun `editorDeleteAndSplitScalar`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt): kotlin.String {
1943
+ return FfiConverterString.lift(
1944
+ uniffiRustCall() { _status ->
1945
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_and_split_scalar(
1946
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),_status)
1947
+ }
1948
+ )
1949
+ }
1950
+
1951
+
1952
+ /**
1953
+ * Delete backward relative to an explicit scalar selection. Returns an update JSON string.
1954
+ */ fun `editorDeleteBackwardAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
1955
+ return FfiConverterString.lift(
1956
+ uniffiRustCall() { _status ->
1957
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_backward_at_selection_scalar(
1958
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
1959
+ }
1960
+ )
1961
+ }
1962
+
1963
+
1964
+ /**
1965
+ * Delete a range. Returns an update JSON string.
1966
+ */ fun `editorDeleteRange`(`id`: kotlin.ULong, `from`: kotlin.UInt, `to`: kotlin.UInt): kotlin.String {
1967
+ return FfiConverterString.lift(
1968
+ uniffiRustCall() { _status ->
1969
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_range(
1970
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`from`),FfiConverterUInt.lower(`to`),_status)
1971
+ }
1972
+ )
1973
+ }
1974
+
1975
+
1976
+ /**
1977
+ * Delete content between two scalar offsets. Returns an update JSON string.
1978
+ */ fun `editorDeleteScalarRange`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt): kotlin.String {
1979
+ return FfiConverterString.lift(
1980
+ uniffiRustCall() { _status ->
1981
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_scalar_range(
1982
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),_status)
1983
+ }
1984
+ )
1985
+ }
1986
+
1987
+
1988
+ /**
1989
+ * Destroy an editor instance, freeing its resources.
1990
+ */ fun `editorDestroy`(`id`: kotlin.ULong)
1991
+ =
1992
+ uniffiRustCall() { _status ->
1993
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_destroy(
1994
+ FfiConverterULong.lower(`id`),_status)
1995
+ }
1996
+
1997
+
1998
+
1999
+ /**
2000
+ * Convert a document position to a rendered-text scalar offset.
2001
+ */ fun `editorDocToScalar`(`id`: kotlin.ULong, `docPos`: kotlin.UInt): kotlin.UInt {
2002
+ return FfiConverterUInt.lift(
2003
+ uniffiRustCall() { _status ->
2004
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_doc_to_scalar(
2005
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`docPos`),_status)
2006
+ }
2007
+ )
2008
+ }
2009
+
2010
+
2011
+ /**
2012
+ * Get both HTML and ProseMirror JSON content in one payload.
2013
+ */ fun `editorGetContentSnapshot`(`id`: kotlin.ULong): kotlin.String {
2014
+ return FfiConverterString.lift(
2015
+ uniffiRustCall() { _status ->
2016
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_content_snapshot(
2017
+ FfiConverterULong.lower(`id`),_status)
2018
+ }
2019
+ )
2020
+ }
2021
+
2022
+
2023
+ /**
2024
+ * Get the current editor state (render elements, selection, active state,
2025
+ * history state) without performing any edits. Used by native views to pull
2026
+ * initial state when binding to an already-loaded editor.
2027
+ */ fun `editorGetCurrentState`(`id`: kotlin.ULong): kotlin.String {
2028
+ return FfiConverterString.lift(
2029
+ uniffiRustCall() { _status ->
2030
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_current_state(
2031
+ FfiConverterULong.lower(`id`),_status)
2032
+ }
2033
+ )
2034
+ }
2035
+
2036
+
2037
+ /**
2038
+ * Get the editor's content as HTML.
2039
+ */ fun `editorGetHtml`(`id`: kotlin.ULong): kotlin.String {
2040
+ return FfiConverterString.lift(
2041
+ uniffiRustCall() { _status ->
2042
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_html(
2043
+ FfiConverterULong.lower(`id`),_status)
2044
+ }
2045
+ )
2046
+ }
2047
+
2048
+
2049
+ /**
2050
+ * Get the editor's content as ProseMirror JSON.
2051
+ */ fun `editorGetJson`(`id`: kotlin.ULong): kotlin.String {
2052
+ return FfiConverterString.lift(
2053
+ uniffiRustCall() { _status ->
2054
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_json(
2055
+ FfiConverterULong.lower(`id`),_status)
2056
+ }
2057
+ )
2058
+ }
2059
+
2060
+
2061
+ /**
2062
+ * Get the current selection as JSON.
2063
+ */ fun `editorGetSelection`(`id`: kotlin.ULong): kotlin.String {
2064
+ return FfiConverterString.lift(
2065
+ uniffiRustCall() { _status ->
2066
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_selection(
2067
+ FfiConverterULong.lower(`id`),_status)
2068
+ }
2069
+ )
2070
+ }
2071
+
2072
+
2073
+ /**
2074
+ * Get the current selection-related editor state without render elements.
2075
+ */ fun `editorGetSelectionState`(`id`: kotlin.ULong): kotlin.String {
2076
+ return FfiConverterString.lift(
2077
+ uniffiRustCall() { _status ->
2078
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_selection_state(
2079
+ FfiConverterULong.lower(`id`),_status)
2080
+ }
2081
+ )
2082
+ }
2083
+
2084
+
2085
+ /**
2086
+ * Indent the current list item into a nested list. Returns an update JSON string.
2087
+ */ fun `editorIndentListItem`(`id`: kotlin.ULong): kotlin.String {
2088
+ return FfiConverterString.lift(
2089
+ uniffiRustCall() { _status ->
2090
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_indent_list_item(
2091
+ FfiConverterULong.lower(`id`),_status)
2092
+ }
2093
+ )
2094
+ }
2095
+
2096
+
2097
+ /**
2098
+ * Indent the list item at an explicit scalar selection. Returns an update JSON string.
2099
+ */ fun `editorIndentListItemAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
2100
+ return FfiConverterString.lift(
2101
+ uniffiRustCall() { _status ->
2102
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_indent_list_item_at_selection_scalar(
2103
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2104
+ }
2105
+ )
2106
+ }
2107
+
2108
+
2109
+ /**
2110
+ * Insert HTML content at the current selection. Returns an update JSON string.
2111
+ */ fun `editorInsertContentHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
2112
+ return FfiConverterString.lift(
2113
+ uniffiRustCall() { _status ->
2114
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_html(
2115
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
2116
+ }
2117
+ )
2118
+ }
2119
+
2120
+
2121
+ /**
2122
+ * Insert JSON content at the current selection. Returns an update JSON string.
2123
+ */ fun `editorInsertContentJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
2124
+ return FfiConverterString.lift(
2125
+ uniffiRustCall() { _status ->
2126
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_json(
2127
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
2128
+ }
2129
+ )
2130
+ }
2131
+
2132
+
2133
+ /**
2134
+ * Insert JSON content at an explicit scalar selection. Returns an update JSON string.
2135
+ */ fun `editorInsertContentJsonAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `json`: kotlin.String): kotlin.String {
2136
+ return FfiConverterString.lift(
2137
+ uniffiRustCall() { _status ->
2138
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_json_at_selection_scalar(
2139
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`json`),_status)
2140
+ }
2141
+ )
2142
+ }
2143
+
2144
+
2145
+ /**
2146
+ * Insert a void node at the current selection. Returns an update JSON string.
2147
+ */ fun `editorInsertNode`(`id`: kotlin.ULong, `nodeType`: kotlin.String): kotlin.String {
2148
+ return FfiConverterString.lift(
2149
+ uniffiRustCall() { _status ->
2150
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_node(
2151
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`nodeType`),_status)
2152
+ }
2153
+ )
2154
+ }
2155
+
2156
+
2157
+ /**
2158
+ * Insert a node at an explicit scalar selection. Returns an update JSON string.
2159
+ */ fun `editorInsertNodeAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `nodeType`: kotlin.String): kotlin.String {
2160
+ return FfiConverterString.lift(
2161
+ uniffiRustCall() { _status ->
2162
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_node_at_selection_scalar(
2163
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`nodeType`),_status)
2164
+ }
2165
+ )
2166
+ }
2167
+
2168
+
2169
+ /**
2170
+ * Insert text at a position. Returns an update JSON string.
2171
+ */ fun `editorInsertText`(`id`: kotlin.ULong, `pos`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
2172
+ return FfiConverterString.lift(
2173
+ uniffiRustCall() { _status ->
2174
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_text(
2175
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`pos`),FfiConverterString.lower(`text`),_status)
2176
+ }
2177
+ )
2178
+ }
2179
+
2180
+
2181
+ /**
2182
+ * Insert text at a scalar offset. Returns an update JSON string.
2183
+ */ fun `editorInsertTextScalar`(`id`: kotlin.ULong, `scalarPos`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
2184
+ return FfiConverterString.lift(
2185
+ uniffiRustCall() { _status ->
2186
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_text_scalar(
2187
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarPos`),FfiConverterString.lower(`text`),_status)
2188
+ }
2189
+ )
2190
+ }
2191
+
2192
+
2193
+ /**
2194
+ * Outdent the current list item to the parent list level. Returns an update JSON string.
2195
+ */ fun `editorOutdentListItem`(`id`: kotlin.ULong): kotlin.String {
2196
+ return FfiConverterString.lift(
2197
+ uniffiRustCall() { _status ->
2198
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_outdent_list_item(
2199
+ FfiConverterULong.lower(`id`),_status)
2200
+ }
2201
+ )
2202
+ }
2203
+
2204
+
2205
+ /**
2206
+ * Outdent the list item at an explicit scalar selection. Returns an update JSON string.
2207
+ */ fun `editorOutdentListItemAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
2208
+ return FfiConverterString.lift(
2209
+ uniffiRustCall() { _status ->
2210
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_outdent_list_item_at_selection_scalar(
2211
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2212
+ }
2213
+ )
2214
+ }
2215
+
2216
+
2217
+ /**
2218
+ * Redo. Returns an update JSON string, or empty string if nothing to redo.
2219
+ */ fun `editorRedo`(`id`: kotlin.ULong): kotlin.String {
2220
+ return FfiConverterString.lift(
2221
+ uniffiRustCall() { _status ->
2222
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_redo(
2223
+ FfiConverterULong.lower(`id`),_status)
2224
+ }
2225
+ )
2226
+ }
2227
+
2228
+
2229
+ /**
2230
+ * Replace entire document content with HTML via a transaction (preserves history).
2231
+ */ fun `editorReplaceHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
2232
+ return FfiConverterString.lift(
2233
+ uniffiRustCall() { _status ->
2234
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_html(
2235
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
2236
+ }
2237
+ )
2238
+ }
2239
+
2240
+
2241
+ /**
2242
+ * Replace entire document content with JSON via a transaction (preserves history).
2243
+ */ fun `editorReplaceJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
2244
+ return FfiConverterString.lift(
2245
+ uniffiRustCall() { _status ->
2246
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_json(
2247
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
2248
+ }
2249
+ )
2250
+ }
2251
+
2252
+
2253
+ /**
2254
+ * Replace the current selection with plain text. Returns an update JSON string.
2255
+ */ fun `editorReplaceSelectionText`(`id`: kotlin.ULong, `text`: kotlin.String): kotlin.String {
2256
+ return FfiConverterString.lift(
2257
+ uniffiRustCall() { _status ->
2258
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_selection_text(
2259
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`text`),_status)
2260
+ }
2261
+ )
2262
+ }
2263
+
2264
+
2265
+ /**
2266
+ * Replace a scalar range with text (atomic delete + insert). Returns an update JSON string.
2267
+ */ fun `editorReplaceTextScalar`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
2268
+ return FfiConverterString.lift(
2269
+ uniffiRustCall() { _status ->
2270
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_text_scalar(
2271
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),FfiConverterString.lower(`text`),_status)
2272
+ }
2273
+ )
2274
+ }
2275
+
2276
+
2277
+ /**
2278
+ * Resize an image node at a document position. Returns an update JSON string.
2279
+ */ fun `editorResizeImageAtDocPos`(`id`: kotlin.ULong, `docPos`: kotlin.UInt, `width`: kotlin.UInt, `height`: kotlin.UInt): kotlin.String {
2280
+ return FfiConverterString.lift(
2281
+ uniffiRustCall() { _status ->
2282
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_resize_image_at_doc_pos(
2283
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`docPos`),FfiConverterUInt.lower(`width`),FfiConverterUInt.lower(`height`),_status)
2284
+ }
2285
+ )
2286
+ }
2287
+
2288
+
2289
+ /**
2290
+ * Convert a rendered-text scalar offset to a document position.
2291
+ */ fun `editorScalarToDoc`(`id`: kotlin.ULong, `scalar`: kotlin.UInt): kotlin.UInt {
2292
+ return FfiConverterUInt.lift(
2293
+ uniffiRustCall() { _status ->
2294
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_scalar_to_doc(
2295
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalar`),_status)
2296
+ }
2297
+ )
2298
+ }
2299
+
2300
+
2301
+ /**
2302
+ * Set the editor's content from an HTML string. Returns render elements as JSON.
2303
+ */ fun `editorSetHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
2304
+ return FfiConverterString.lift(
2305
+ uniffiRustCall() { _status ->
2306
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_html(
2307
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
2308
+ }
2309
+ )
2310
+ }
2311
+
2312
+
2313
+ /**
2314
+ * Set the editor's content from a ProseMirror JSON string.
2315
+ */ fun `editorSetJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
2316
+ return FfiConverterString.lift(
2317
+ uniffiRustCall() { _status ->
2318
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_json(
2319
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
2320
+ }
2321
+ )
2322
+ }
2323
+
2324
+
2325
+ /**
2326
+ * Set a mark with attrs on the current selection. Returns an update JSON string.
2327
+ */ fun `editorSetMark`(`id`: kotlin.ULong, `markName`: kotlin.String, `attrsJson`: kotlin.String): kotlin.String {
2328
+ return FfiConverterString.lift(
2329
+ uniffiRustCall() { _status ->
2330
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_mark(
2331
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`markName`),FfiConverterString.lower(`attrsJson`),_status)
2332
+ }
2333
+ )
2334
+ }
2335
+
2336
+
2337
+ /**
2338
+ * Set a mark with attrs at an explicit scalar selection. Returns an update JSON string.
2339
+ */ fun `editorSetMarkAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `markName`: kotlin.String, `attrsJson`: kotlin.String): kotlin.String {
2340
+ return FfiConverterString.lift(
2341
+ uniffiRustCall() { _status ->
2342
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_mark_at_selection_scalar(
2343
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`markName`),FfiConverterString.lower(`attrsJson`),_status)
2344
+ }
2345
+ )
2346
+ }
2347
+
2348
+
2349
+ /**
2350
+ * Set the selection. Anchor and head are document positions.
2351
+ */ fun `editorSetSelection`(`id`: kotlin.ULong, `anchor`: kotlin.UInt, `head`: kotlin.UInt)
2352
+ =
2353
+ uniffiRustCall() { _status ->
2354
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_selection(
2355
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`anchor`),FfiConverterUInt.lower(`head`),_status)
2356
+ }
2357
+
2358
+
2359
+
2360
+ /**
2361
+ * Set the selection from scalar offsets, converting to document positions internally.
2362
+ */ fun `editorSetSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt)
2363
+ =
2364
+ uniffiRustCall() { _status ->
2365
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_selection_scalar(
2366
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2367
+ }
2368
+
2369
+
2370
+
2371
+ /**
2372
+ * Split the block at a position (Enter key). Returns an update JSON string.
2373
+ */ fun `editorSplitBlock`(`id`: kotlin.ULong, `pos`: kotlin.UInt): kotlin.String {
2374
+ return FfiConverterString.lift(
2375
+ uniffiRustCall() { _status ->
2376
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_split_block(
2377
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`pos`),_status)
2378
+ }
2379
+ )
2380
+ }
2381
+
2382
+
2383
+ /**
2384
+ * Split a block at a scalar offset. Returns an update JSON string.
2385
+ */ fun `editorSplitBlockScalar`(`id`: kotlin.ULong, `scalarPos`: kotlin.UInt): kotlin.String {
2386
+ return FfiConverterString.lift(
2387
+ uniffiRustCall() { _status ->
2388
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_split_block_scalar(
2389
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarPos`),_status)
2390
+ }
2391
+ )
2392
+ }
2393
+
2394
+
2395
+ /**
2396
+ * Toggle a blockquote around the current block selection. Returns an update JSON string.
2397
+ */ fun `editorToggleBlockquote`(`id`: kotlin.ULong): kotlin.String {
2398
+ return FfiConverterString.lift(
2399
+ uniffiRustCall() { _status ->
2400
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_blockquote(
2401
+ FfiConverterULong.lower(`id`),_status)
2402
+ }
2403
+ )
2404
+ }
2405
+
2406
+
2407
+ /**
2408
+ * Toggle a blockquote at an explicit scalar selection. Returns an update JSON string.
2409
+ */ fun `editorToggleBlockquoteAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
2410
+ return FfiConverterString.lift(
2411
+ uniffiRustCall() { _status ->
2412
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_blockquote_at_selection_scalar(
2413
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2414
+ }
2415
+ )
2416
+ }
2417
+
2418
+
2419
+ /**
2420
+ * Toggle a heading level on the current text-block selection. Returns an update JSON string.
2421
+ */ fun `editorToggleHeading`(`id`: kotlin.ULong, `level`: kotlin.UByte): kotlin.String {
2422
+ return FfiConverterString.lift(
2423
+ uniffiRustCall() { _status ->
2424
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_heading(
2425
+ FfiConverterULong.lower(`id`),FfiConverterUByte.lower(`level`),_status)
2426
+ }
2427
+ )
2428
+ }
2429
+
2430
+
2431
+ /**
2432
+ * Toggle a heading level at an explicit scalar selection. Returns an update JSON string.
2433
+ */ fun `editorToggleHeadingAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `level`: kotlin.UByte): kotlin.String {
2434
+ return FfiConverterString.lift(
2435
+ uniffiRustCall() { _status ->
2436
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_heading_at_selection_scalar(
2437
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterUByte.lower(`level`),_status)
2438
+ }
2439
+ )
2440
+ }
2441
+
2442
+
2443
+ /**
2444
+ * Toggle a mark on the current selection. Returns an update JSON string.
2445
+ */ fun `editorToggleMark`(`id`: kotlin.ULong, `markName`: kotlin.String): kotlin.String {
2446
+ return FfiConverterString.lift(
2447
+ uniffiRustCall() { _status ->
2448
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_mark(
2449
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`markName`),_status)
2450
+ }
2451
+ )
2452
+ }
2453
+
2454
+
2455
+ /**
2456
+ * Toggle a mark at an explicit scalar selection. Returns an update JSON string.
2457
+ */ fun `editorToggleMarkAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `markName`: kotlin.String): kotlin.String {
2458
+ return FfiConverterString.lift(
2459
+ uniffiRustCall() { _status ->
2460
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_mark_at_selection_scalar(
2461
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`markName`),_status)
2462
+ }
2463
+ )
2464
+ }
2465
+
2466
+
2467
+ /**
2468
+ * Toggle the checked state of the task item at an explicit scalar selection.
2469
+ */ fun `editorToggleTaskItemCheckedAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
2470
+ return FfiConverterString.lift(
2471
+ uniffiRustCall() { _status ->
2472
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_task_item_checked_at_selection_scalar(
2473
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2474
+ }
2475
+ )
2476
+ }
2477
+
2478
+
2479
+ /**
2480
+ * Undo. Returns an update JSON string, or empty string if nothing to undo.
2481
+ */ fun `editorUndo`(`id`: kotlin.ULong): kotlin.String {
2482
+ return FfiConverterString.lift(
2483
+ uniffiRustCall() { _status ->
2484
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_undo(
2485
+ FfiConverterULong.lower(`id`),_status)
2486
+ }
2487
+ )
2488
+ }
2489
+
2490
+
2491
+ /**
2492
+ * Remove a mark from the current selection. Returns an update JSON string.
2493
+ */ fun `editorUnsetMark`(`id`: kotlin.ULong, `markName`: kotlin.String): kotlin.String {
2494
+ return FfiConverterString.lift(
2495
+ uniffiRustCall() { _status ->
2496
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unset_mark(
2497
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`markName`),_status)
2498
+ }
2499
+ )
2500
+ }
2501
+
2502
+
2503
+ /**
2504
+ * Remove a mark at an explicit scalar selection. Returns an update JSON string.
2505
+ */ fun `editorUnsetMarkAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `markName`: kotlin.String): kotlin.String {
2506
+ return FfiConverterString.lift(
2507
+ uniffiRustCall() { _status ->
2508
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unset_mark_at_selection_scalar(
2509
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`markName`),_status)
2510
+ }
2511
+ )
2512
+ }
2513
+
2514
+
2515
+ /**
2516
+ * Unwrap the current list item back to a paragraph. Returns an update JSON string.
2517
+ */ fun `editorUnwrapFromList`(`id`: kotlin.ULong): kotlin.String {
2518
+ return FfiConverterString.lift(
2519
+ uniffiRustCall() { _status ->
2520
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unwrap_from_list(
2521
+ FfiConverterULong.lower(`id`),_status)
2522
+ }
2523
+ )
2524
+ }
2525
+
2526
+
2527
+ /**
2528
+ * Unwrap the list item at an explicit scalar selection. Returns an update JSON string.
2529
+ */ fun `editorUnwrapFromListAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
2530
+ return FfiConverterString.lift(
2531
+ uniffiRustCall() { _status ->
2532
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unwrap_from_list_at_selection_scalar(
2533
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
2534
+ }
2535
+ )
2536
+ }
2537
+
2538
+
2539
+ /**
2540
+ * Wrap the current selection in a list. Returns an update JSON string.
2541
+ */ fun `editorWrapInList`(`id`: kotlin.ULong, `listType`: kotlin.String): kotlin.String {
2542
+ return FfiConverterString.lift(
2543
+ uniffiRustCall() { _status ->
2544
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_wrap_in_list(
2545
+ FfiConverterULong.lower(`id`),FfiConverterString.lower(`listType`),_status)
2546
+ }
2547
+ )
2548
+ }
2549
+
2550
+
2551
+ /**
2552
+ * Wrap or convert a list at an explicit scalar selection. Returns an update JSON string.
2553
+ */ fun `editorWrapInListAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `listType`: kotlin.String): kotlin.String {
2554
+ return FfiConverterString.lift(
2555
+ uniffiRustCall() { _status ->
2556
+ UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_wrap_in_list_at_selection_scalar(
2557
+ FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`listType`),_status)
2558
+ }
2559
+ )
2560
+ }
2561
+
2562
+
2563
+