@apollohg/react-native-prose-editor 0.1.0
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.
- package/LICENSE +160 -0
- package/README.md +143 -0
- package/android/build.gradle +39 -0
- package/android/src/main/assets/editor-icons/MaterialIcons.json +2236 -0
- package/android/src/main/assets/editor-icons/MaterialIcons.ttf +0 -0
- package/android/src/main/java/com/apollohg/editor/EditorAddons.kt +131 -0
- package/android/src/main/java/com/apollohg/editor/EditorEditText.kt +1057 -0
- package/android/src/main/java/com/apollohg/editor/EditorHeightBehavior.kt +14 -0
- package/android/src/main/java/com/apollohg/editor/EditorInputConnection.kt +191 -0
- package/android/src/main/java/com/apollohg/editor/EditorTheme.kt +325 -0
- package/android/src/main/java/com/apollohg/editor/NativeEditorExpoView.kt +647 -0
- package/android/src/main/java/com/apollohg/editor/NativeEditorModule.kt +257 -0
- package/android/src/main/java/com/apollohg/editor/NativeToolbar.kt +714 -0
- package/android/src/main/java/com/apollohg/editor/PositionBridge.kt +76 -0
- package/android/src/main/java/com/apollohg/editor/RenderBridge.kt +1044 -0
- package/android/src/main/java/com/apollohg/editor/RichTextEditorView.kt +211 -0
- package/expo-module.config.json +9 -0
- package/ios/EditorAddons.swift +228 -0
- package/ios/EditorCore.xcframework/Info.plist +44 -0
- package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
- package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
- package/ios/EditorLayoutManager.swift +254 -0
- package/ios/EditorTheme.swift +372 -0
- package/ios/Generated_editor_core.swift +1143 -0
- package/ios/NativeEditorExpoView.swift +1417 -0
- package/ios/NativeEditorModule.swift +263 -0
- package/ios/PositionBridge.swift +278 -0
- package/ios/ReactNativeProseEditor.podspec +49 -0
- package/ios/RenderBridge.swift +825 -0
- package/ios/RichTextEditorView.swift +1559 -0
- package/ios/editor_coreFFI/editor_coreFFI.h +1014 -0
- package/ios/editor_coreFFI/module.modulemap +7 -0
- package/ios/editor_coreFFI.h +904 -0
- package/ios/editor_coreFFI.modulemap +7 -0
- package/package.json +66 -0
- package/rust/android/arm64-v8a/libeditor_core.so +0 -0
- package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
- package/rust/android/x86_64/libeditor_core.so +0 -0
- package/rust/bindings/kotlin/uniffi/editor_core/editor_core.kt +2014 -0
- package/src/EditorTheme.ts +130 -0
- package/src/EditorToolbar.tsx +620 -0
- package/src/NativeEditorBridge.ts +607 -0
- package/src/NativeRichTextEditor.tsx +951 -0
- package/src/addons.ts +158 -0
- package/src/index.ts +63 -0
- package/src/schemas.ts +153 -0
- package/src/useNativeEditor.ts +173 -0
|
@@ -0,0 +1,2014 @@
|
|
|
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
|
+
// For large crates we prevent `MethodTooLargeException` (see #2340)
|
|
801
|
+
// N.B. the name of the extension is very misleading, since it is
|
|
802
|
+
// rather `InterfaceTooLargeException`, caused by too many methods
|
|
803
|
+
// in the interface for large crates.
|
|
804
|
+
//
|
|
805
|
+
// By splitting the otherwise huge interface into two parts
|
|
806
|
+
// * UniffiLib
|
|
807
|
+
// * IntegrityCheckingUniffiLib (this)
|
|
808
|
+
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
809
|
+
//
|
|
810
|
+
// The `ffi_uniffi_contract_version` method and all checksum methods are put
|
|
811
|
+
// into `IntegrityCheckingUniffiLib` and these methods are called only once,
|
|
812
|
+
// when the library is loaded.
|
|
813
|
+
internal interface IntegrityCheckingUniffiLib : Library {
|
|
814
|
+
// Integrity check functions only
|
|
815
|
+
fun uniffi_editor_core_checksum_func_editor_can_redo(
|
|
816
|
+
): Short
|
|
817
|
+
fun uniffi_editor_core_checksum_func_editor_can_undo(
|
|
818
|
+
): Short
|
|
819
|
+
fun uniffi_editor_core_checksum_func_editor_core_version(
|
|
820
|
+
): Short
|
|
821
|
+
fun uniffi_editor_core_checksum_func_editor_create(
|
|
822
|
+
): Short
|
|
823
|
+
fun uniffi_editor_core_checksum_func_editor_delete_and_split_scalar(
|
|
824
|
+
): Short
|
|
825
|
+
fun uniffi_editor_core_checksum_func_editor_delete_range(
|
|
826
|
+
): Short
|
|
827
|
+
fun uniffi_editor_core_checksum_func_editor_delete_scalar_range(
|
|
828
|
+
): Short
|
|
829
|
+
fun uniffi_editor_core_checksum_func_editor_destroy(
|
|
830
|
+
): Short
|
|
831
|
+
fun uniffi_editor_core_checksum_func_editor_doc_to_scalar(
|
|
832
|
+
): Short
|
|
833
|
+
fun uniffi_editor_core_checksum_func_editor_get_current_state(
|
|
834
|
+
): Short
|
|
835
|
+
fun uniffi_editor_core_checksum_func_editor_get_html(
|
|
836
|
+
): Short
|
|
837
|
+
fun uniffi_editor_core_checksum_func_editor_get_json(
|
|
838
|
+
): Short
|
|
839
|
+
fun uniffi_editor_core_checksum_func_editor_get_selection(
|
|
840
|
+
): Short
|
|
841
|
+
fun uniffi_editor_core_checksum_func_editor_indent_list_item(
|
|
842
|
+
): Short
|
|
843
|
+
fun uniffi_editor_core_checksum_func_editor_indent_list_item_at_selection_scalar(
|
|
844
|
+
): Short
|
|
845
|
+
fun uniffi_editor_core_checksum_func_editor_insert_content_html(
|
|
846
|
+
): Short
|
|
847
|
+
fun uniffi_editor_core_checksum_func_editor_insert_content_json(
|
|
848
|
+
): Short
|
|
849
|
+
fun uniffi_editor_core_checksum_func_editor_insert_content_json_at_selection_scalar(
|
|
850
|
+
): Short
|
|
851
|
+
fun uniffi_editor_core_checksum_func_editor_insert_node(
|
|
852
|
+
): Short
|
|
853
|
+
fun uniffi_editor_core_checksum_func_editor_insert_node_at_selection_scalar(
|
|
854
|
+
): Short
|
|
855
|
+
fun uniffi_editor_core_checksum_func_editor_insert_text(
|
|
856
|
+
): Short
|
|
857
|
+
fun uniffi_editor_core_checksum_func_editor_insert_text_scalar(
|
|
858
|
+
): Short
|
|
859
|
+
fun uniffi_editor_core_checksum_func_editor_outdent_list_item(
|
|
860
|
+
): Short
|
|
861
|
+
fun uniffi_editor_core_checksum_func_editor_outdent_list_item_at_selection_scalar(
|
|
862
|
+
): Short
|
|
863
|
+
fun uniffi_editor_core_checksum_func_editor_redo(
|
|
864
|
+
): Short
|
|
865
|
+
fun uniffi_editor_core_checksum_func_editor_replace_html(
|
|
866
|
+
): Short
|
|
867
|
+
fun uniffi_editor_core_checksum_func_editor_replace_json(
|
|
868
|
+
): Short
|
|
869
|
+
fun uniffi_editor_core_checksum_func_editor_replace_selection_text(
|
|
870
|
+
): Short
|
|
871
|
+
fun uniffi_editor_core_checksum_func_editor_replace_text_scalar(
|
|
872
|
+
): Short
|
|
873
|
+
fun uniffi_editor_core_checksum_func_editor_scalar_to_doc(
|
|
874
|
+
): Short
|
|
875
|
+
fun uniffi_editor_core_checksum_func_editor_set_html(
|
|
876
|
+
): Short
|
|
877
|
+
fun uniffi_editor_core_checksum_func_editor_set_json(
|
|
878
|
+
): Short
|
|
879
|
+
fun uniffi_editor_core_checksum_func_editor_set_selection(
|
|
880
|
+
): Short
|
|
881
|
+
fun uniffi_editor_core_checksum_func_editor_set_selection_scalar(
|
|
882
|
+
): Short
|
|
883
|
+
fun uniffi_editor_core_checksum_func_editor_split_block(
|
|
884
|
+
): Short
|
|
885
|
+
fun uniffi_editor_core_checksum_func_editor_split_block_scalar(
|
|
886
|
+
): Short
|
|
887
|
+
fun uniffi_editor_core_checksum_func_editor_toggle_mark(
|
|
888
|
+
): Short
|
|
889
|
+
fun uniffi_editor_core_checksum_func_editor_toggle_mark_at_selection_scalar(
|
|
890
|
+
): Short
|
|
891
|
+
fun uniffi_editor_core_checksum_func_editor_undo(
|
|
892
|
+
): Short
|
|
893
|
+
fun uniffi_editor_core_checksum_func_editor_unwrap_from_list(
|
|
894
|
+
): Short
|
|
895
|
+
fun uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar(
|
|
896
|
+
): Short
|
|
897
|
+
fun uniffi_editor_core_checksum_func_editor_wrap_in_list(
|
|
898
|
+
): Short
|
|
899
|
+
fun uniffi_editor_core_checksum_func_editor_wrap_in_list_at_selection_scalar(
|
|
900
|
+
): Short
|
|
901
|
+
fun ffi_editor_core_uniffi_contract_version(
|
|
902
|
+
): Int
|
|
903
|
+
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// A JNA Library to expose the extern-C FFI definitions.
|
|
907
|
+
// This is an implementation detail which will be called internally by the public API.
|
|
908
|
+
internal interface UniffiLib : Library {
|
|
909
|
+
companion object {
|
|
910
|
+
internal val INSTANCE: UniffiLib by lazy {
|
|
911
|
+
val componentName = "editor_core"
|
|
912
|
+
// For large crates we prevent `MethodTooLargeException` (see #2340)
|
|
913
|
+
// N.B. the name of the extension is very misleading, since it is
|
|
914
|
+
// rather `InterfaceTooLargeException`, caused by too many methods
|
|
915
|
+
// in the interface for large crates.
|
|
916
|
+
//
|
|
917
|
+
// By splitting the otherwise huge interface into two parts
|
|
918
|
+
// * UniffiLib (this)
|
|
919
|
+
// * IntegrityCheckingUniffiLib
|
|
920
|
+
// And all checksum methods are put into `IntegrityCheckingUniffiLib`
|
|
921
|
+
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
922
|
+
//
|
|
923
|
+
// Thus we first load the library with `loadIndirect` as `IntegrityCheckingUniffiLib`
|
|
924
|
+
// so that we can (optionally!) call `uniffiCheckApiChecksums`...
|
|
925
|
+
loadIndirect<IntegrityCheckingUniffiLib>(componentName)
|
|
926
|
+
.also { lib: IntegrityCheckingUniffiLib ->
|
|
927
|
+
uniffiCheckContractApiVersion(lib)
|
|
928
|
+
uniffiCheckApiChecksums(lib)
|
|
929
|
+
}
|
|
930
|
+
// ... and then we load the library as `UniffiLib`
|
|
931
|
+
// N.B. we cannot use `loadIndirect` once and then try to cast it to `UniffiLib`
|
|
932
|
+
// => results in `java.lang.ClassCastException: com.sun.proxy.$Proxy cannot be cast to ...`
|
|
933
|
+
// error. So we must call `loadIndirect` twice. For crates large enough
|
|
934
|
+
// to trigger this issue, the performance impact is negligible, running on
|
|
935
|
+
// a macOS M1 machine the `loadIndirect` call takes ~50ms.
|
|
936
|
+
val lib = loadIndirect<UniffiLib>(componentName)
|
|
937
|
+
// No need to check the contract version and checksums, since
|
|
938
|
+
// we already did that with `IntegrityCheckingUniffiLib` above.
|
|
939
|
+
// Loading of library with integrity check done.
|
|
940
|
+
lib
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// FFI functions
|
|
946
|
+
fun uniffi_editor_core_fn_func_editor_can_redo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
947
|
+
): Byte
|
|
948
|
+
fun uniffi_editor_core_fn_func_editor_can_undo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
949
|
+
): Byte
|
|
950
|
+
fun uniffi_editor_core_fn_func_editor_core_version(uniffi_out_err: UniffiRustCallStatus,
|
|
951
|
+
): RustBuffer.ByValue
|
|
952
|
+
fun uniffi_editor_core_fn_func_editor_create(`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
953
|
+
): Long
|
|
954
|
+
fun uniffi_editor_core_fn_func_editor_delete_and_split_scalar(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
955
|
+
): RustBuffer.ByValue
|
|
956
|
+
fun uniffi_editor_core_fn_func_editor_delete_range(`id`: Long,`from`: Int,`to`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
957
|
+
): RustBuffer.ByValue
|
|
958
|
+
fun uniffi_editor_core_fn_func_editor_delete_scalar_range(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
959
|
+
): RustBuffer.ByValue
|
|
960
|
+
fun uniffi_editor_core_fn_func_editor_destroy(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
961
|
+
): Unit
|
|
962
|
+
fun uniffi_editor_core_fn_func_editor_doc_to_scalar(`id`: Long,`docPos`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
963
|
+
): Int
|
|
964
|
+
fun uniffi_editor_core_fn_func_editor_get_current_state(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
965
|
+
): RustBuffer.ByValue
|
|
966
|
+
fun uniffi_editor_core_fn_func_editor_get_html(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
967
|
+
): RustBuffer.ByValue
|
|
968
|
+
fun uniffi_editor_core_fn_func_editor_get_json(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
969
|
+
): RustBuffer.ByValue
|
|
970
|
+
fun uniffi_editor_core_fn_func_editor_get_selection(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
971
|
+
): RustBuffer.ByValue
|
|
972
|
+
fun uniffi_editor_core_fn_func_editor_indent_list_item(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
973
|
+
): RustBuffer.ByValue
|
|
974
|
+
fun uniffi_editor_core_fn_func_editor_indent_list_item_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
975
|
+
): RustBuffer.ByValue
|
|
976
|
+
fun uniffi_editor_core_fn_func_editor_insert_content_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
977
|
+
): RustBuffer.ByValue
|
|
978
|
+
fun uniffi_editor_core_fn_func_editor_insert_content_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
979
|
+
): RustBuffer.ByValue
|
|
980
|
+
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,
|
|
981
|
+
): RustBuffer.ByValue
|
|
982
|
+
fun uniffi_editor_core_fn_func_editor_insert_node(`id`: Long,`nodeType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
983
|
+
): RustBuffer.ByValue
|
|
984
|
+
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,
|
|
985
|
+
): RustBuffer.ByValue
|
|
986
|
+
fun uniffi_editor_core_fn_func_editor_insert_text(`id`: Long,`pos`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
987
|
+
): RustBuffer.ByValue
|
|
988
|
+
fun uniffi_editor_core_fn_func_editor_insert_text_scalar(`id`: Long,`scalarPos`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
989
|
+
): RustBuffer.ByValue
|
|
990
|
+
fun uniffi_editor_core_fn_func_editor_outdent_list_item(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
991
|
+
): RustBuffer.ByValue
|
|
992
|
+
fun uniffi_editor_core_fn_func_editor_outdent_list_item_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
993
|
+
): RustBuffer.ByValue
|
|
994
|
+
fun uniffi_editor_core_fn_func_editor_redo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
995
|
+
): RustBuffer.ByValue
|
|
996
|
+
fun uniffi_editor_core_fn_func_editor_replace_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
997
|
+
): RustBuffer.ByValue
|
|
998
|
+
fun uniffi_editor_core_fn_func_editor_replace_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
999
|
+
): RustBuffer.ByValue
|
|
1000
|
+
fun uniffi_editor_core_fn_func_editor_replace_selection_text(`id`: Long,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1001
|
+
): RustBuffer.ByValue
|
|
1002
|
+
fun uniffi_editor_core_fn_func_editor_replace_text_scalar(`id`: Long,`scalarFrom`: Int,`scalarTo`: Int,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1003
|
+
): RustBuffer.ByValue
|
|
1004
|
+
fun uniffi_editor_core_fn_func_editor_scalar_to_doc(`id`: Long,`scalar`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1005
|
+
): Int
|
|
1006
|
+
fun uniffi_editor_core_fn_func_editor_set_html(`id`: Long,`html`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1007
|
+
): RustBuffer.ByValue
|
|
1008
|
+
fun uniffi_editor_core_fn_func_editor_set_json(`id`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1009
|
+
): RustBuffer.ByValue
|
|
1010
|
+
fun uniffi_editor_core_fn_func_editor_set_selection(`id`: Long,`anchor`: Int,`head`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1011
|
+
): Unit
|
|
1012
|
+
fun uniffi_editor_core_fn_func_editor_set_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1013
|
+
): Unit
|
|
1014
|
+
fun uniffi_editor_core_fn_func_editor_split_block(`id`: Long,`pos`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1015
|
+
): RustBuffer.ByValue
|
|
1016
|
+
fun uniffi_editor_core_fn_func_editor_split_block_scalar(`id`: Long,`scalarPos`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1017
|
+
): RustBuffer.ByValue
|
|
1018
|
+
fun uniffi_editor_core_fn_func_editor_toggle_mark(`id`: Long,`markName`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1019
|
+
): RustBuffer.ByValue
|
|
1020
|
+
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,
|
|
1021
|
+
): RustBuffer.ByValue
|
|
1022
|
+
fun uniffi_editor_core_fn_func_editor_undo(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1023
|
+
): RustBuffer.ByValue
|
|
1024
|
+
fun uniffi_editor_core_fn_func_editor_unwrap_from_list(`id`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1025
|
+
): RustBuffer.ByValue
|
|
1026
|
+
fun uniffi_editor_core_fn_func_editor_unwrap_from_list_at_selection_scalar(`id`: Long,`scalarAnchor`: Int,`scalarHead`: Int,uniffi_out_err: UniffiRustCallStatus,
|
|
1027
|
+
): RustBuffer.ByValue
|
|
1028
|
+
fun uniffi_editor_core_fn_func_editor_wrap_in_list(`id`: Long,`listType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1029
|
+
): RustBuffer.ByValue
|
|
1030
|
+
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,
|
|
1031
|
+
): RustBuffer.ByValue
|
|
1032
|
+
fun ffi_editor_core_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1033
|
+
): RustBuffer.ByValue
|
|
1034
|
+
fun ffi_editor_core_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1035
|
+
): RustBuffer.ByValue
|
|
1036
|
+
fun ffi_editor_core_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
|
|
1037
|
+
): Unit
|
|
1038
|
+
fun ffi_editor_core_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1039
|
+
): RustBuffer.ByValue
|
|
1040
|
+
fun ffi_editor_core_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1041
|
+
): Unit
|
|
1042
|
+
fun ffi_editor_core_rust_future_cancel_u8(`handle`: Long,
|
|
1043
|
+
): Unit
|
|
1044
|
+
fun ffi_editor_core_rust_future_free_u8(`handle`: Long,
|
|
1045
|
+
): Unit
|
|
1046
|
+
fun ffi_editor_core_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1047
|
+
): Byte
|
|
1048
|
+
fun ffi_editor_core_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1049
|
+
): Unit
|
|
1050
|
+
fun ffi_editor_core_rust_future_cancel_i8(`handle`: Long,
|
|
1051
|
+
): Unit
|
|
1052
|
+
fun ffi_editor_core_rust_future_free_i8(`handle`: Long,
|
|
1053
|
+
): Unit
|
|
1054
|
+
fun ffi_editor_core_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1055
|
+
): Byte
|
|
1056
|
+
fun ffi_editor_core_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1057
|
+
): Unit
|
|
1058
|
+
fun ffi_editor_core_rust_future_cancel_u16(`handle`: Long,
|
|
1059
|
+
): Unit
|
|
1060
|
+
fun ffi_editor_core_rust_future_free_u16(`handle`: Long,
|
|
1061
|
+
): Unit
|
|
1062
|
+
fun ffi_editor_core_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1063
|
+
): Short
|
|
1064
|
+
fun ffi_editor_core_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1065
|
+
): Unit
|
|
1066
|
+
fun ffi_editor_core_rust_future_cancel_i16(`handle`: Long,
|
|
1067
|
+
): Unit
|
|
1068
|
+
fun ffi_editor_core_rust_future_free_i16(`handle`: Long,
|
|
1069
|
+
): Unit
|
|
1070
|
+
fun ffi_editor_core_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1071
|
+
): Short
|
|
1072
|
+
fun ffi_editor_core_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1073
|
+
): Unit
|
|
1074
|
+
fun ffi_editor_core_rust_future_cancel_u32(`handle`: Long,
|
|
1075
|
+
): Unit
|
|
1076
|
+
fun ffi_editor_core_rust_future_free_u32(`handle`: Long,
|
|
1077
|
+
): Unit
|
|
1078
|
+
fun ffi_editor_core_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1079
|
+
): Int
|
|
1080
|
+
fun ffi_editor_core_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1081
|
+
): Unit
|
|
1082
|
+
fun ffi_editor_core_rust_future_cancel_i32(`handle`: Long,
|
|
1083
|
+
): Unit
|
|
1084
|
+
fun ffi_editor_core_rust_future_free_i32(`handle`: Long,
|
|
1085
|
+
): Unit
|
|
1086
|
+
fun ffi_editor_core_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1087
|
+
): Int
|
|
1088
|
+
fun ffi_editor_core_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1089
|
+
): Unit
|
|
1090
|
+
fun ffi_editor_core_rust_future_cancel_u64(`handle`: Long,
|
|
1091
|
+
): Unit
|
|
1092
|
+
fun ffi_editor_core_rust_future_free_u64(`handle`: Long,
|
|
1093
|
+
): Unit
|
|
1094
|
+
fun ffi_editor_core_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1095
|
+
): Long
|
|
1096
|
+
fun ffi_editor_core_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1097
|
+
): Unit
|
|
1098
|
+
fun ffi_editor_core_rust_future_cancel_i64(`handle`: Long,
|
|
1099
|
+
): Unit
|
|
1100
|
+
fun ffi_editor_core_rust_future_free_i64(`handle`: Long,
|
|
1101
|
+
): Unit
|
|
1102
|
+
fun ffi_editor_core_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1103
|
+
): Long
|
|
1104
|
+
fun ffi_editor_core_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1105
|
+
): Unit
|
|
1106
|
+
fun ffi_editor_core_rust_future_cancel_f32(`handle`: Long,
|
|
1107
|
+
): Unit
|
|
1108
|
+
fun ffi_editor_core_rust_future_free_f32(`handle`: Long,
|
|
1109
|
+
): Unit
|
|
1110
|
+
fun ffi_editor_core_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1111
|
+
): Float
|
|
1112
|
+
fun ffi_editor_core_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1113
|
+
): Unit
|
|
1114
|
+
fun ffi_editor_core_rust_future_cancel_f64(`handle`: Long,
|
|
1115
|
+
): Unit
|
|
1116
|
+
fun ffi_editor_core_rust_future_free_f64(`handle`: Long,
|
|
1117
|
+
): Unit
|
|
1118
|
+
fun ffi_editor_core_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1119
|
+
): Double
|
|
1120
|
+
fun ffi_editor_core_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1121
|
+
): Unit
|
|
1122
|
+
fun ffi_editor_core_rust_future_cancel_pointer(`handle`: Long,
|
|
1123
|
+
): Unit
|
|
1124
|
+
fun ffi_editor_core_rust_future_free_pointer(`handle`: Long,
|
|
1125
|
+
): Unit
|
|
1126
|
+
fun ffi_editor_core_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1127
|
+
): Pointer
|
|
1128
|
+
fun ffi_editor_core_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1129
|
+
): Unit
|
|
1130
|
+
fun ffi_editor_core_rust_future_cancel_rust_buffer(`handle`: Long,
|
|
1131
|
+
): Unit
|
|
1132
|
+
fun ffi_editor_core_rust_future_free_rust_buffer(`handle`: Long,
|
|
1133
|
+
): Unit
|
|
1134
|
+
fun ffi_editor_core_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1135
|
+
): RustBuffer.ByValue
|
|
1136
|
+
fun ffi_editor_core_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
|
|
1137
|
+
): Unit
|
|
1138
|
+
fun ffi_editor_core_rust_future_cancel_void(`handle`: Long,
|
|
1139
|
+
): Unit
|
|
1140
|
+
fun ffi_editor_core_rust_future_free_void(`handle`: Long,
|
|
1141
|
+
): Unit
|
|
1142
|
+
fun ffi_editor_core_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
|
|
1143
|
+
): Unit
|
|
1144
|
+
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
|
|
1148
|
+
// Get the bindings contract version from our ComponentInterface
|
|
1149
|
+
val bindings_contract_version = 29
|
|
1150
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
1151
|
+
val scaffolding_contract_version = lib.ffi_editor_core_uniffi_contract_version()
|
|
1152
|
+
if (bindings_contract_version != scaffolding_contract_version) {
|
|
1153
|
+
throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
@Suppress("UNUSED_PARAMETER")
|
|
1157
|
+
private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
|
|
1158
|
+
if (lib.uniffi_editor_core_checksum_func_editor_can_redo() != 15854.toShort()) {
|
|
1159
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1160
|
+
}
|
|
1161
|
+
if (lib.uniffi_editor_core_checksum_func_editor_can_undo() != 52062.toShort()) {
|
|
1162
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1163
|
+
}
|
|
1164
|
+
if (lib.uniffi_editor_core_checksum_func_editor_core_version() != 41638.toShort()) {
|
|
1165
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1166
|
+
}
|
|
1167
|
+
if (lib.uniffi_editor_core_checksum_func_editor_create() != 23908.toShort()) {
|
|
1168
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1169
|
+
}
|
|
1170
|
+
if (lib.uniffi_editor_core_checksum_func_editor_delete_and_split_scalar() != 13764.toShort()) {
|
|
1171
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1172
|
+
}
|
|
1173
|
+
if (lib.uniffi_editor_core_checksum_func_editor_delete_range() != 6109.toShort()) {
|
|
1174
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1175
|
+
}
|
|
1176
|
+
if (lib.uniffi_editor_core_checksum_func_editor_delete_scalar_range() != 60098.toShort()) {
|
|
1177
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1178
|
+
}
|
|
1179
|
+
if (lib.uniffi_editor_core_checksum_func_editor_destroy() != 35774.toShort()) {
|
|
1180
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1181
|
+
}
|
|
1182
|
+
if (lib.uniffi_editor_core_checksum_func_editor_doc_to_scalar() != 48291.toShort()) {
|
|
1183
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1184
|
+
}
|
|
1185
|
+
if (lib.uniffi_editor_core_checksum_func_editor_get_current_state() != 13946.toShort()) {
|
|
1186
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1187
|
+
}
|
|
1188
|
+
if (lib.uniffi_editor_core_checksum_func_editor_get_html() != 28868.toShort()) {
|
|
1189
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1190
|
+
}
|
|
1191
|
+
if (lib.uniffi_editor_core_checksum_func_editor_get_json() != 8212.toShort()) {
|
|
1192
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1193
|
+
}
|
|
1194
|
+
if (lib.uniffi_editor_core_checksum_func_editor_get_selection() != 20571.toShort()) {
|
|
1195
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1196
|
+
}
|
|
1197
|
+
if (lib.uniffi_editor_core_checksum_func_editor_indent_list_item() != 10818.toShort()) {
|
|
1198
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1199
|
+
}
|
|
1200
|
+
if (lib.uniffi_editor_core_checksum_func_editor_indent_list_item_at_selection_scalar() != 13664.toShort()) {
|
|
1201
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1202
|
+
}
|
|
1203
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_content_html() != 62700.toShort()) {
|
|
1204
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1205
|
+
}
|
|
1206
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_content_json() != 56904.toShort()) {
|
|
1207
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1208
|
+
}
|
|
1209
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_content_json_at_selection_scalar() != 51362.toShort()) {
|
|
1210
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1211
|
+
}
|
|
1212
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_node() != 22371.toShort()) {
|
|
1213
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1214
|
+
}
|
|
1215
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_node_at_selection_scalar() != 32254.toShort()) {
|
|
1216
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1217
|
+
}
|
|
1218
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_text() != 22584.toShort()) {
|
|
1219
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1220
|
+
}
|
|
1221
|
+
if (lib.uniffi_editor_core_checksum_func_editor_insert_text_scalar() != 30263.toShort()) {
|
|
1222
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1223
|
+
}
|
|
1224
|
+
if (lib.uniffi_editor_core_checksum_func_editor_outdent_list_item() != 55796.toShort()) {
|
|
1225
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1226
|
+
}
|
|
1227
|
+
if (lib.uniffi_editor_core_checksum_func_editor_outdent_list_item_at_selection_scalar() != 32672.toShort()) {
|
|
1228
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1229
|
+
}
|
|
1230
|
+
if (lib.uniffi_editor_core_checksum_func_editor_redo() != 26508.toShort()) {
|
|
1231
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1232
|
+
}
|
|
1233
|
+
if (lib.uniffi_editor_core_checksum_func_editor_replace_html() != 41778.toShort()) {
|
|
1234
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1235
|
+
}
|
|
1236
|
+
if (lib.uniffi_editor_core_checksum_func_editor_replace_json() != 28738.toShort()) {
|
|
1237
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1238
|
+
}
|
|
1239
|
+
if (lib.uniffi_editor_core_checksum_func_editor_replace_selection_text() != 11138.toShort()) {
|
|
1240
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1241
|
+
}
|
|
1242
|
+
if (lib.uniffi_editor_core_checksum_func_editor_replace_text_scalar() != 45475.toShort()) {
|
|
1243
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1244
|
+
}
|
|
1245
|
+
if (lib.uniffi_editor_core_checksum_func_editor_scalar_to_doc() != 40126.toShort()) {
|
|
1246
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1247
|
+
}
|
|
1248
|
+
if (lib.uniffi_editor_core_checksum_func_editor_set_html() != 11045.toShort()) {
|
|
1249
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1250
|
+
}
|
|
1251
|
+
if (lib.uniffi_editor_core_checksum_func_editor_set_json() != 18497.toShort()) {
|
|
1252
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1253
|
+
}
|
|
1254
|
+
if (lib.uniffi_editor_core_checksum_func_editor_set_selection() != 28236.toShort()) {
|
|
1255
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1256
|
+
}
|
|
1257
|
+
if (lib.uniffi_editor_core_checksum_func_editor_set_selection_scalar() != 16443.toShort()) {
|
|
1258
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1259
|
+
}
|
|
1260
|
+
if (lib.uniffi_editor_core_checksum_func_editor_split_block() != 52038.toShort()) {
|
|
1261
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1262
|
+
}
|
|
1263
|
+
if (lib.uniffi_editor_core_checksum_func_editor_split_block_scalar() != 47554.toShort()) {
|
|
1264
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1265
|
+
}
|
|
1266
|
+
if (lib.uniffi_editor_core_checksum_func_editor_toggle_mark() != 30661.toShort()) {
|
|
1267
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1268
|
+
}
|
|
1269
|
+
if (lib.uniffi_editor_core_checksum_func_editor_toggle_mark_at_selection_scalar() != 61751.toShort()) {
|
|
1270
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1271
|
+
}
|
|
1272
|
+
if (lib.uniffi_editor_core_checksum_func_editor_undo() != 28689.toShort()) {
|
|
1273
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1274
|
+
}
|
|
1275
|
+
if (lib.uniffi_editor_core_checksum_func_editor_unwrap_from_list() != 41875.toShort()) {
|
|
1276
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1277
|
+
}
|
|
1278
|
+
if (lib.uniffi_editor_core_checksum_func_editor_unwrap_from_list_at_selection_scalar() != 57899.toShort()) {
|
|
1279
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1280
|
+
}
|
|
1281
|
+
if (lib.uniffi_editor_core_checksum_func_editor_wrap_in_list() != 32846.toShort()) {
|
|
1282
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1283
|
+
}
|
|
1284
|
+
if (lib.uniffi_editor_core_checksum_func_editor_wrap_in_list_at_selection_scalar() != 6459.toShort()) {
|
|
1285
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* @suppress
|
|
1291
|
+
*/
|
|
1292
|
+
public fun uniffiEnsureInitialized() {
|
|
1293
|
+
UniffiLib.INSTANCE
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
// Async support
|
|
1297
|
+
|
|
1298
|
+
// Public interface members begin here.
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
// Interface implemented by anything that can contain an object reference.
|
|
1302
|
+
//
|
|
1303
|
+
// Such types expose a `destroy()` method that must be called to cleanly
|
|
1304
|
+
// dispose of the contained objects. Failure to call this method may result
|
|
1305
|
+
// in memory leaks.
|
|
1306
|
+
//
|
|
1307
|
+
// The easiest way to ensure this method is called is to use the `.use`
|
|
1308
|
+
// helper method to execute a block and destroy the object at the end.
|
|
1309
|
+
interface Disposable {
|
|
1310
|
+
fun destroy()
|
|
1311
|
+
companion object {
|
|
1312
|
+
fun destroy(vararg args: Any?) {
|
|
1313
|
+
for (arg in args) {
|
|
1314
|
+
when (arg) {
|
|
1315
|
+
is Disposable -> arg.destroy()
|
|
1316
|
+
is ArrayList<*> -> {
|
|
1317
|
+
for (idx in arg.indices) {
|
|
1318
|
+
val element = arg[idx]
|
|
1319
|
+
if (element is Disposable) {
|
|
1320
|
+
element.destroy()
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
is Map<*, *> -> {
|
|
1325
|
+
for (element in arg.values) {
|
|
1326
|
+
if (element is Disposable) {
|
|
1327
|
+
element.destroy()
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
is Iterable<*> -> {
|
|
1332
|
+
for (element in arg) {
|
|
1333
|
+
if (element is Disposable) {
|
|
1334
|
+
element.destroy()
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* @suppress
|
|
1346
|
+
*/
|
|
1347
|
+
inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
|
|
1348
|
+
try {
|
|
1349
|
+
block(this)
|
|
1350
|
+
} finally {
|
|
1351
|
+
try {
|
|
1352
|
+
// N.B. our implementation is on the nullable type `Disposable?`.
|
|
1353
|
+
this?.destroy()
|
|
1354
|
+
} catch (e: Throwable) {
|
|
1355
|
+
// swallow
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
|
|
1361
|
+
*
|
|
1362
|
+
* @suppress
|
|
1363
|
+
* */
|
|
1364
|
+
object NoPointer
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* @suppress
|
|
1368
|
+
*/
|
|
1369
|
+
public object FfiConverterUInt: FfiConverter<UInt, Int> {
|
|
1370
|
+
override fun lift(value: Int): UInt {
|
|
1371
|
+
return value.toUInt()
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
override fun read(buf: ByteBuffer): UInt {
|
|
1375
|
+
return lift(buf.getInt())
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
override fun lower(value: UInt): Int {
|
|
1379
|
+
return value.toInt()
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
override fun allocationSize(value: UInt) = 4UL
|
|
1383
|
+
|
|
1384
|
+
override fun write(value: UInt, buf: ByteBuffer) {
|
|
1385
|
+
buf.putInt(value.toInt())
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* @suppress
|
|
1391
|
+
*/
|
|
1392
|
+
public object FfiConverterULong: FfiConverter<ULong, Long> {
|
|
1393
|
+
override fun lift(value: Long): ULong {
|
|
1394
|
+
return value.toULong()
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
override fun read(buf: ByteBuffer): ULong {
|
|
1398
|
+
return lift(buf.getLong())
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
override fun lower(value: ULong): Long {
|
|
1402
|
+
return value.toLong()
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
override fun allocationSize(value: ULong) = 8UL
|
|
1406
|
+
|
|
1407
|
+
override fun write(value: ULong, buf: ByteBuffer) {
|
|
1408
|
+
buf.putLong(value.toLong())
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* @suppress
|
|
1414
|
+
*/
|
|
1415
|
+
public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
|
|
1416
|
+
override fun lift(value: Byte): Boolean {
|
|
1417
|
+
return value.toInt() != 0
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
override fun read(buf: ByteBuffer): Boolean {
|
|
1421
|
+
return lift(buf.get())
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
override fun lower(value: Boolean): Byte {
|
|
1425
|
+
return if (value) 1.toByte() else 0.toByte()
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
override fun allocationSize(value: Boolean) = 1UL
|
|
1429
|
+
|
|
1430
|
+
override fun write(value: Boolean, buf: ByteBuffer) {
|
|
1431
|
+
buf.put(lower(value))
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* @suppress
|
|
1437
|
+
*/
|
|
1438
|
+
public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
1439
|
+
// Note: we don't inherit from FfiConverterRustBuffer, because we use a
|
|
1440
|
+
// special encoding when lowering/lifting. We can use `RustBuffer.len` to
|
|
1441
|
+
// store our length and avoid writing it out to the buffer.
|
|
1442
|
+
override fun lift(value: RustBuffer.ByValue): String {
|
|
1443
|
+
try {
|
|
1444
|
+
val byteArr = ByteArray(value.len.toInt())
|
|
1445
|
+
value.asByteBuffer()!!.get(byteArr)
|
|
1446
|
+
return byteArr.toString(Charsets.UTF_8)
|
|
1447
|
+
} finally {
|
|
1448
|
+
RustBuffer.free(value)
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
override fun read(buf: ByteBuffer): String {
|
|
1453
|
+
val len = buf.getInt()
|
|
1454
|
+
val byteArr = ByteArray(len)
|
|
1455
|
+
buf.get(byteArr)
|
|
1456
|
+
return byteArr.toString(Charsets.UTF_8)
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
fun toUtf8(value: String): ByteBuffer {
|
|
1460
|
+
// Make sure we don't have invalid UTF-16, check for lone surrogates.
|
|
1461
|
+
return Charsets.UTF_8.newEncoder().run {
|
|
1462
|
+
onMalformedInput(CodingErrorAction.REPORT)
|
|
1463
|
+
encode(CharBuffer.wrap(value))
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
override fun lower(value: String): RustBuffer.ByValue {
|
|
1468
|
+
val byteBuf = toUtf8(value)
|
|
1469
|
+
// Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
|
|
1470
|
+
// to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
|
|
1471
|
+
val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
|
|
1472
|
+
rbuf.asByteBuffer()!!.put(byteBuf)
|
|
1473
|
+
return rbuf
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
// We aren't sure exactly how many bytes our string will be once it's UTF-8
|
|
1477
|
+
// encoded. Allocate 3 bytes per UTF-16 code unit which will always be
|
|
1478
|
+
// enough.
|
|
1479
|
+
override fun allocationSize(value: String): ULong {
|
|
1480
|
+
val sizeForLength = 4UL
|
|
1481
|
+
val sizeForString = value.length.toULong() * 3UL
|
|
1482
|
+
return sizeForLength + sizeForString
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
override fun write(value: String, buf: ByteBuffer) {
|
|
1486
|
+
val byteBuf = toUtf8(value)
|
|
1487
|
+
buf.putInt(byteBuf.limit())
|
|
1488
|
+
buf.put(byteBuf)
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Check if redo is available.
|
|
1493
|
+
*/ fun `editorCanRedo`(`id`: kotlin.ULong): kotlin.Boolean {
|
|
1494
|
+
return FfiConverterBoolean.lift(
|
|
1495
|
+
uniffiRustCall() { _status ->
|
|
1496
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_can_redo(
|
|
1497
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1498
|
+
}
|
|
1499
|
+
)
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Check if undo is available.
|
|
1505
|
+
*/ fun `editorCanUndo`(`id`: kotlin.ULong): kotlin.Boolean {
|
|
1506
|
+
return FfiConverterBoolean.lift(
|
|
1507
|
+
uniffiRustCall() { _status ->
|
|
1508
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_can_undo(
|
|
1509
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Return the crate version string.
|
|
1517
|
+
*/ fun `editorCoreVersion`(): kotlin.String {
|
|
1518
|
+
return FfiConverterString.lift(
|
|
1519
|
+
uniffiRustCall() { _status ->
|
|
1520
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_core_version(
|
|
1521
|
+
_status)
|
|
1522
|
+
}
|
|
1523
|
+
)
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Create a new editor from a JSON config object.
|
|
1529
|
+
*
|
|
1530
|
+
* Config fields (all optional — empty object `{}` creates a default editor):
|
|
1531
|
+
* - `"schema"`: custom schema definition (see `Schema::from_json`)
|
|
1532
|
+
* - `"maxLength"`: maximum document length in characters
|
|
1533
|
+
* - `"readOnly"`: if `true`, rejects non-API mutations
|
|
1534
|
+
* - `"inputFilter"`: regex pattern; only matching characters are inserted
|
|
1535
|
+
*
|
|
1536
|
+
* Falls back to the default Tiptap schema when `"schema"` is absent or invalid.
|
|
1537
|
+
*/ fun `editorCreate`(`configJson`: kotlin.String): kotlin.ULong {
|
|
1538
|
+
return FfiConverterULong.lift(
|
|
1539
|
+
uniffiRustCall() { _status ->
|
|
1540
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_create(
|
|
1541
|
+
FfiConverterString.lower(`configJson`),_status)
|
|
1542
|
+
}
|
|
1543
|
+
)
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* Delete a scalar range then split the block (Enter with selection). Returns an update.
|
|
1549
|
+
*/ fun `editorDeleteAndSplitScalar`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt): kotlin.String {
|
|
1550
|
+
return FfiConverterString.lift(
|
|
1551
|
+
uniffiRustCall() { _status ->
|
|
1552
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_and_split_scalar(
|
|
1553
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),_status)
|
|
1554
|
+
}
|
|
1555
|
+
)
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* Delete a range. Returns an update JSON string.
|
|
1561
|
+
*/ fun `editorDeleteRange`(`id`: kotlin.ULong, `from`: kotlin.UInt, `to`: kotlin.UInt): kotlin.String {
|
|
1562
|
+
return FfiConverterString.lift(
|
|
1563
|
+
uniffiRustCall() { _status ->
|
|
1564
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_range(
|
|
1565
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`from`),FfiConverterUInt.lower(`to`),_status)
|
|
1566
|
+
}
|
|
1567
|
+
)
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* Delete content between two scalar offsets. Returns an update JSON string.
|
|
1573
|
+
*/ fun `editorDeleteScalarRange`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt): kotlin.String {
|
|
1574
|
+
return FfiConverterString.lift(
|
|
1575
|
+
uniffiRustCall() { _status ->
|
|
1576
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_delete_scalar_range(
|
|
1577
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),_status)
|
|
1578
|
+
}
|
|
1579
|
+
)
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* Destroy an editor instance, freeing its resources.
|
|
1585
|
+
*/ fun `editorDestroy`(`id`: kotlin.ULong)
|
|
1586
|
+
=
|
|
1587
|
+
uniffiRustCall() { _status ->
|
|
1588
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_destroy(
|
|
1589
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Convert a document position to a rendered-text scalar offset.
|
|
1596
|
+
*/ fun `editorDocToScalar`(`id`: kotlin.ULong, `docPos`: kotlin.UInt): kotlin.UInt {
|
|
1597
|
+
return FfiConverterUInt.lift(
|
|
1598
|
+
uniffiRustCall() { _status ->
|
|
1599
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_doc_to_scalar(
|
|
1600
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`docPos`),_status)
|
|
1601
|
+
}
|
|
1602
|
+
)
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Get the current editor state (render elements, selection, active state,
|
|
1608
|
+
* history state) without performing any edits. Used by native views to pull
|
|
1609
|
+
* initial state when binding to an already-loaded editor.
|
|
1610
|
+
*/ fun `editorGetCurrentState`(`id`: kotlin.ULong): kotlin.String {
|
|
1611
|
+
return FfiConverterString.lift(
|
|
1612
|
+
uniffiRustCall() { _status ->
|
|
1613
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_current_state(
|
|
1614
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1615
|
+
}
|
|
1616
|
+
)
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Get the editor's content as HTML.
|
|
1622
|
+
*/ fun `editorGetHtml`(`id`: kotlin.ULong): kotlin.String {
|
|
1623
|
+
return FfiConverterString.lift(
|
|
1624
|
+
uniffiRustCall() { _status ->
|
|
1625
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_html(
|
|
1626
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1627
|
+
}
|
|
1628
|
+
)
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* Get the editor's content as ProseMirror JSON.
|
|
1634
|
+
*/ fun `editorGetJson`(`id`: kotlin.ULong): kotlin.String {
|
|
1635
|
+
return FfiConverterString.lift(
|
|
1636
|
+
uniffiRustCall() { _status ->
|
|
1637
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_json(
|
|
1638
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1639
|
+
}
|
|
1640
|
+
)
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
/**
|
|
1645
|
+
* Get the current selection as JSON.
|
|
1646
|
+
*/ fun `editorGetSelection`(`id`: kotlin.ULong): kotlin.String {
|
|
1647
|
+
return FfiConverterString.lift(
|
|
1648
|
+
uniffiRustCall() { _status ->
|
|
1649
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_get_selection(
|
|
1650
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1651
|
+
}
|
|
1652
|
+
)
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Indent the current list item into a nested list. Returns an update JSON string.
|
|
1658
|
+
*/ fun `editorIndentListItem`(`id`: kotlin.ULong): kotlin.String {
|
|
1659
|
+
return FfiConverterString.lift(
|
|
1660
|
+
uniffiRustCall() { _status ->
|
|
1661
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_indent_list_item(
|
|
1662
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1663
|
+
}
|
|
1664
|
+
)
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Indent the list item at an explicit scalar selection. Returns an update JSON string.
|
|
1670
|
+
*/ fun `editorIndentListItemAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
|
|
1671
|
+
return FfiConverterString.lift(
|
|
1672
|
+
uniffiRustCall() { _status ->
|
|
1673
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_indent_list_item_at_selection_scalar(
|
|
1674
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
|
|
1675
|
+
}
|
|
1676
|
+
)
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* Insert HTML content at the current selection. Returns an update JSON string.
|
|
1682
|
+
*/ fun `editorInsertContentHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
|
|
1683
|
+
return FfiConverterString.lift(
|
|
1684
|
+
uniffiRustCall() { _status ->
|
|
1685
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_html(
|
|
1686
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
|
|
1687
|
+
}
|
|
1688
|
+
)
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* Insert JSON content at the current selection. Returns an update JSON string.
|
|
1694
|
+
*/ fun `editorInsertContentJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
|
|
1695
|
+
return FfiConverterString.lift(
|
|
1696
|
+
uniffiRustCall() { _status ->
|
|
1697
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_json(
|
|
1698
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
|
|
1699
|
+
}
|
|
1700
|
+
)
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Insert JSON content at an explicit scalar selection. Returns an update JSON string.
|
|
1706
|
+
*/ fun `editorInsertContentJsonAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `json`: kotlin.String): kotlin.String {
|
|
1707
|
+
return FfiConverterString.lift(
|
|
1708
|
+
uniffiRustCall() { _status ->
|
|
1709
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_content_json_at_selection_scalar(
|
|
1710
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`json`),_status)
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Insert a void node at the current selection. Returns an update JSON string.
|
|
1718
|
+
*/ fun `editorInsertNode`(`id`: kotlin.ULong, `nodeType`: kotlin.String): kotlin.String {
|
|
1719
|
+
return FfiConverterString.lift(
|
|
1720
|
+
uniffiRustCall() { _status ->
|
|
1721
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_node(
|
|
1722
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`nodeType`),_status)
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* Insert a node at an explicit scalar selection. Returns an update JSON string.
|
|
1730
|
+
*/ fun `editorInsertNodeAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `nodeType`: kotlin.String): kotlin.String {
|
|
1731
|
+
return FfiConverterString.lift(
|
|
1732
|
+
uniffiRustCall() { _status ->
|
|
1733
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_node_at_selection_scalar(
|
|
1734
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`nodeType`),_status)
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Insert text at a position. Returns an update JSON string.
|
|
1742
|
+
*/ fun `editorInsertText`(`id`: kotlin.ULong, `pos`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
|
|
1743
|
+
return FfiConverterString.lift(
|
|
1744
|
+
uniffiRustCall() { _status ->
|
|
1745
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_text(
|
|
1746
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`pos`),FfiConverterString.lower(`text`),_status)
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Insert text at a scalar offset. Returns an update JSON string.
|
|
1754
|
+
*/ fun `editorInsertTextScalar`(`id`: kotlin.ULong, `scalarPos`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
|
|
1755
|
+
return FfiConverterString.lift(
|
|
1756
|
+
uniffiRustCall() { _status ->
|
|
1757
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_insert_text_scalar(
|
|
1758
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarPos`),FfiConverterString.lower(`text`),_status)
|
|
1759
|
+
}
|
|
1760
|
+
)
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
/**
|
|
1765
|
+
* Outdent the current list item to the parent list level. Returns an update JSON string.
|
|
1766
|
+
*/ fun `editorOutdentListItem`(`id`: kotlin.ULong): kotlin.String {
|
|
1767
|
+
return FfiConverterString.lift(
|
|
1768
|
+
uniffiRustCall() { _status ->
|
|
1769
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_outdent_list_item(
|
|
1770
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1771
|
+
}
|
|
1772
|
+
)
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* Outdent the list item at an explicit scalar selection. Returns an update JSON string.
|
|
1778
|
+
*/ fun `editorOutdentListItemAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
|
|
1779
|
+
return FfiConverterString.lift(
|
|
1780
|
+
uniffiRustCall() { _status ->
|
|
1781
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_outdent_list_item_at_selection_scalar(
|
|
1782
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Redo. Returns an update JSON string, or empty string if nothing to redo.
|
|
1790
|
+
*/ fun `editorRedo`(`id`: kotlin.ULong): kotlin.String {
|
|
1791
|
+
return FfiConverterString.lift(
|
|
1792
|
+
uniffiRustCall() { _status ->
|
|
1793
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_redo(
|
|
1794
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1795
|
+
}
|
|
1796
|
+
)
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Replace entire document content with HTML via a transaction (preserves history).
|
|
1802
|
+
*/ fun `editorReplaceHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
|
|
1803
|
+
return FfiConverterString.lift(
|
|
1804
|
+
uniffiRustCall() { _status ->
|
|
1805
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_html(
|
|
1806
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
|
|
1807
|
+
}
|
|
1808
|
+
)
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Replace entire document content with JSON via a transaction (preserves history).
|
|
1814
|
+
*/ fun `editorReplaceJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
|
|
1815
|
+
return FfiConverterString.lift(
|
|
1816
|
+
uniffiRustCall() { _status ->
|
|
1817
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_json(
|
|
1818
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
|
|
1819
|
+
}
|
|
1820
|
+
)
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Replace the current selection with plain text. Returns an update JSON string.
|
|
1826
|
+
*/ fun `editorReplaceSelectionText`(`id`: kotlin.ULong, `text`: kotlin.String): kotlin.String {
|
|
1827
|
+
return FfiConverterString.lift(
|
|
1828
|
+
uniffiRustCall() { _status ->
|
|
1829
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_selection_text(
|
|
1830
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`text`),_status)
|
|
1831
|
+
}
|
|
1832
|
+
)
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
|
|
1836
|
+
/**
|
|
1837
|
+
* Replace a scalar range with text (atomic delete + insert). Returns an update JSON string.
|
|
1838
|
+
*/ fun `editorReplaceTextScalar`(`id`: kotlin.ULong, `scalarFrom`: kotlin.UInt, `scalarTo`: kotlin.UInt, `text`: kotlin.String): kotlin.String {
|
|
1839
|
+
return FfiConverterString.lift(
|
|
1840
|
+
uniffiRustCall() { _status ->
|
|
1841
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_replace_text_scalar(
|
|
1842
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarFrom`),FfiConverterUInt.lower(`scalarTo`),FfiConverterString.lower(`text`),_status)
|
|
1843
|
+
}
|
|
1844
|
+
)
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* Convert a rendered-text scalar offset to a document position.
|
|
1850
|
+
*/ fun `editorScalarToDoc`(`id`: kotlin.ULong, `scalar`: kotlin.UInt): kotlin.UInt {
|
|
1851
|
+
return FfiConverterUInt.lift(
|
|
1852
|
+
uniffiRustCall() { _status ->
|
|
1853
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_scalar_to_doc(
|
|
1854
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalar`),_status)
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Set the editor's content from an HTML string. Returns render elements as JSON.
|
|
1862
|
+
*/ fun `editorSetHtml`(`id`: kotlin.ULong, `html`: kotlin.String): kotlin.String {
|
|
1863
|
+
return FfiConverterString.lift(
|
|
1864
|
+
uniffiRustCall() { _status ->
|
|
1865
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_html(
|
|
1866
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`html`),_status)
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* Set the editor's content from a ProseMirror JSON string.
|
|
1874
|
+
*/ fun `editorSetJson`(`id`: kotlin.ULong, `json`: kotlin.String): kotlin.String {
|
|
1875
|
+
return FfiConverterString.lift(
|
|
1876
|
+
uniffiRustCall() { _status ->
|
|
1877
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_json(
|
|
1878
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`json`),_status)
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Set the selection. Anchor and head are document positions.
|
|
1886
|
+
*/ fun `editorSetSelection`(`id`: kotlin.ULong, `anchor`: kotlin.UInt, `head`: kotlin.UInt)
|
|
1887
|
+
=
|
|
1888
|
+
uniffiRustCall() { _status ->
|
|
1889
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_selection(
|
|
1890
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`anchor`),FfiConverterUInt.lower(`head`),_status)
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Set the selection from scalar offsets, converting to document positions internally.
|
|
1897
|
+
*/ fun `editorSetSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt)
|
|
1898
|
+
=
|
|
1899
|
+
uniffiRustCall() { _status ->
|
|
1900
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_set_selection_scalar(
|
|
1901
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Split the block at a position (Enter key). Returns an update JSON string.
|
|
1908
|
+
*/ fun `editorSplitBlock`(`id`: kotlin.ULong, `pos`: kotlin.UInt): kotlin.String {
|
|
1909
|
+
return FfiConverterString.lift(
|
|
1910
|
+
uniffiRustCall() { _status ->
|
|
1911
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_split_block(
|
|
1912
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`pos`),_status)
|
|
1913
|
+
}
|
|
1914
|
+
)
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* Split a block at a scalar offset. Returns an update JSON string.
|
|
1920
|
+
*/ fun `editorSplitBlockScalar`(`id`: kotlin.ULong, `scalarPos`: kotlin.UInt): kotlin.String {
|
|
1921
|
+
return FfiConverterString.lift(
|
|
1922
|
+
uniffiRustCall() { _status ->
|
|
1923
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_split_block_scalar(
|
|
1924
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarPos`),_status)
|
|
1925
|
+
}
|
|
1926
|
+
)
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* Toggle a mark on the current selection. Returns an update JSON string.
|
|
1932
|
+
*/ fun `editorToggleMark`(`id`: kotlin.ULong, `markName`: kotlin.String): kotlin.String {
|
|
1933
|
+
return FfiConverterString.lift(
|
|
1934
|
+
uniffiRustCall() { _status ->
|
|
1935
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_mark(
|
|
1936
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`markName`),_status)
|
|
1937
|
+
}
|
|
1938
|
+
)
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Toggle a mark at an explicit scalar selection. Returns an update JSON string.
|
|
1944
|
+
*/ fun `editorToggleMarkAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `markName`: kotlin.String): kotlin.String {
|
|
1945
|
+
return FfiConverterString.lift(
|
|
1946
|
+
uniffiRustCall() { _status ->
|
|
1947
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_toggle_mark_at_selection_scalar(
|
|
1948
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`markName`),_status)
|
|
1949
|
+
}
|
|
1950
|
+
)
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* Undo. Returns an update JSON string, or empty string if nothing to undo.
|
|
1956
|
+
*/ fun `editorUndo`(`id`: kotlin.ULong): kotlin.String {
|
|
1957
|
+
return FfiConverterString.lift(
|
|
1958
|
+
uniffiRustCall() { _status ->
|
|
1959
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_undo(
|
|
1960
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1961
|
+
}
|
|
1962
|
+
)
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
/**
|
|
1967
|
+
* Unwrap the current list item back to a paragraph. Returns an update JSON string.
|
|
1968
|
+
*/ fun `editorUnwrapFromList`(`id`: kotlin.ULong): kotlin.String {
|
|
1969
|
+
return FfiConverterString.lift(
|
|
1970
|
+
uniffiRustCall() { _status ->
|
|
1971
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unwrap_from_list(
|
|
1972
|
+
FfiConverterULong.lower(`id`),_status)
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Unwrap the list item at an explicit scalar selection. Returns an update JSON string.
|
|
1980
|
+
*/ fun `editorUnwrapFromListAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt): kotlin.String {
|
|
1981
|
+
return FfiConverterString.lift(
|
|
1982
|
+
uniffiRustCall() { _status ->
|
|
1983
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_unwrap_from_list_at_selection_scalar(
|
|
1984
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),_status)
|
|
1985
|
+
}
|
|
1986
|
+
)
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* Wrap the current selection in a list. Returns an update JSON string.
|
|
1992
|
+
*/ fun `editorWrapInList`(`id`: kotlin.ULong, `listType`: kotlin.String): kotlin.String {
|
|
1993
|
+
return FfiConverterString.lift(
|
|
1994
|
+
uniffiRustCall() { _status ->
|
|
1995
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_wrap_in_list(
|
|
1996
|
+
FfiConverterULong.lower(`id`),FfiConverterString.lower(`listType`),_status)
|
|
1997
|
+
}
|
|
1998
|
+
)
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Wrap or convert a list at an explicit scalar selection. Returns an update JSON string.
|
|
2004
|
+
*/ fun `editorWrapInListAtSelectionScalar`(`id`: kotlin.ULong, `scalarAnchor`: kotlin.UInt, `scalarHead`: kotlin.UInt, `listType`: kotlin.String): kotlin.String {
|
|
2005
|
+
return FfiConverterString.lift(
|
|
2006
|
+
uniffiRustCall() { _status ->
|
|
2007
|
+
UniffiLib.INSTANCE.uniffi_editor_core_fn_func_editor_wrap_in_list_at_selection_scalar(
|
|
2008
|
+
FfiConverterULong.lower(`id`),FfiConverterUInt.lower(`scalarAnchor`),FfiConverterUInt.lower(`scalarHead`),FfiConverterString.lower(`listType`),_status)
|
|
2009
|
+
}
|
|
2010
|
+
)
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
|