Commit a3ef8fd4 authored by 李朝发's avatar 李朝发

update

parent 355c23af
...@@ -42,7 +42,7 @@ dependencies { ...@@ -42,7 +42,7 @@ dependencies {
def USERNAME = "lizhaofa" def USERNAME = "lizhaofa"
def PASSWORD = "0oh7bcnZtweAo7EX" def PASSWORD = "0oh7bcnZtweAo7EX"
def VERSION = "1.0.11" def VERSION = "1.0.12"
def RELEASE_REPOSITORY_URL = "https://hub.zmcms.cn/repository/maven-releases" def RELEASE_REPOSITORY_URL = "https://hub.zmcms.cn/repository/maven-releases"
afterEvaluate { afterEvaluate {
......
...@@ -42,7 +42,7 @@ open class RustBuffer : Structure() { ...@@ -42,7 +42,7 @@ open class RustBuffer : Structure() {
companion object { companion object {
internal fun alloc(size: Int = 0) = rustCall() { status -> internal fun alloc(size: Int = 0) = rustCall() { status ->
_UniFFILib.INSTANCE.ffi_NativeSocket_2c48_rustbuffer_alloc(size, status).also { _UniFFILib.INSTANCE.ffi_NativeSocket_8561_rustbuffer_alloc(size, status).also {
if(it.data == null) { if(it.data == null) {
throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})") throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
} }
...@@ -50,7 +50,7 @@ open class RustBuffer : Structure() { ...@@ -50,7 +50,7 @@ open class RustBuffer : Structure() {
} }
internal fun free(buf: RustBuffer.ByValue) = rustCall() { status -> internal fun free(buf: RustBuffer.ByValue) = rustCall() { status ->
_UniFFILib.INSTANCE.ffi_NativeSocket_2c48_rustbuffer_free(buf, status) _UniFFILib.INSTANCE.ffi_NativeSocket_8561_rustbuffer_free(buf, status)
} }
} }
...@@ -259,91 +259,91 @@ internal interface _UniFFILib : Library { ...@@ -259,91 +259,91 @@ internal interface _UniFFILib : Library {
} }
} }
fun ffi_NativeSocket_2c48_NativeSocketBuilder_object_free(`ptr`: Pointer, fun ffi_NativeSocket_8561_NativeSocketBuilder_object_free(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Unit ): Unit
fun NativeSocket_2c48_NativeSocketBuilder_new( fun NativeSocket_8561_NativeSocketBuilder_new(
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_host(`ptr`: Pointer,`host`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_host(`ptr`: Pointer,`host`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_token(`ptr`: Pointer,`token`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_token(`ptr`: Pointer,`token`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_brand(`ptr`: Pointer,`brand`: Int, fun NativeSocket_8561_NativeSocketBuilder_brand(`ptr`: Pointer,`brand`: Int,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_store(`ptr`: Pointer,`store`: Int, fun NativeSocket_8561_NativeSocketBuilder_store(`ptr`: Pointer,`store`: Int,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_device(`ptr`: Pointer,`device`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_device(`ptr`: Pointer,`device`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_ty(`ptr`: Pointer,`type`: Int, fun NativeSocket_8561_NativeSocketBuilder_ty(`ptr`: Pointer,`type`: Int,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_clean_start(`ptr`: Pointer,`cleanStart`: Byte, fun NativeSocket_8561_NativeSocketBuilder_clean_start(`ptr`: Pointer,`cleanStart`: Byte,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_cache_dir(`ptr`: Pointer,`cacheDir`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_cache_dir(`ptr`: Pointer,`cacheDir`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_log_level(`ptr`: Pointer,`logLevel`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_log_level(`ptr`: Pointer,`logLevel`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_version(`ptr`: Pointer,`version`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocketBuilder_version(`ptr`: Pointer,`version`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Pointer ): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_build(`ptr`: Pointer, fun NativeSocket_8561_NativeSocketBuilder_build(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_NativeSocket_object_free(`ptr`: Pointer, fun ffi_NativeSocket_8561_NativeSocket_object_free(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Unit ): Unit
fun NativeSocket_2c48_NativeSocket_poll(`ptr`: Pointer, fun NativeSocket_8561_NativeSocket_poll(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun NativeSocket_2c48_NativeSocket_try_poll(`ptr`: Pointer, fun NativeSocket_8561_NativeSocket_try_poll(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun NativeSocket_2c48_NativeSocket_poll_timeout(`ptr`: Pointer,`timeout`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocket_poll_timeout(`ptr`: Pointer,`timeout`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun NativeSocket_2c48_NativeSocket_invoke(`ptr`: Pointer,`input`: RustBuffer.ByValue, fun NativeSocket_8561_NativeSocket_invoke(`ptr`: Pointer,`input`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_rustbuffer_alloc(`size`: Int, fun ffi_NativeSocket_8561_rustbuffer_alloc(`size`: Int,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue, fun ffi_NativeSocket_8561_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_rustbuffer_free(`buf`: RustBuffer.ByValue, fun ffi_NativeSocket_8561_rustbuffer_free(`buf`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): Unit ): Unit
fun ffi_NativeSocket_2c48_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Int, fun ffi_NativeSocket_8561_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Int,
_uniffi_out_err: RustCallStatus _uniffi_out_err: RustCallStatus
): RustBuffer.ByValue ): RustBuffer.ByValue
...@@ -706,14 +706,14 @@ class NativeSocket( ...@@ -706,14 +706,14 @@ class NativeSocket(
*/ */
override protected fun freeRustArcPtr() { override protected fun freeRustArcPtr() {
rustCall() { status -> rustCall() { status ->
_UniFFILib.INSTANCE.ffi_NativeSocket_2c48_NativeSocket_object_free(this.pointer, status) _UniFFILib.INSTANCE.ffi_NativeSocket_8561_NativeSocket_object_free(this.pointer, status)
} }
} }
override fun `poll`(): Message? = override fun `poll`(): Message? =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_poll(it, _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_poll(it, _status)
} }
}.let { }.let {
FfiConverterOptionalTypeMessage.lift(it) FfiConverterOptionalTypeMessage.lift(it)
...@@ -721,7 +721,7 @@ class NativeSocket( ...@@ -721,7 +721,7 @@ class NativeSocket(
override fun `tryPoll`(): Message? = override fun `tryPoll`(): Message? =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_try_poll(it, _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_try_poll(it, _status)
} }
}.let { }.let {
FfiConverterOptionalTypeMessage.lift(it) FfiConverterOptionalTypeMessage.lift(it)
...@@ -729,7 +729,7 @@ class NativeSocket( ...@@ -729,7 +729,7 @@ class NativeSocket(
override fun `pollTimeout`(`timeout`: java.time.Duration): Message? = override fun `pollTimeout`(`timeout`: java.time.Duration): Message? =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_poll_timeout(it, FfiConverterDuration.lower(`timeout`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_poll_timeout(it, FfiConverterDuration.lower(`timeout`), _status)
} }
}.let { }.let {
FfiConverterOptionalTypeMessage.lift(it) FfiConverterOptionalTypeMessage.lift(it)
...@@ -737,7 +737,7 @@ class NativeSocket( ...@@ -737,7 +737,7 @@ class NativeSocket(
override fun `invoke`(`input`: InvokeInput): InvokeOutput = override fun `invoke`(`input`: InvokeInput): InvokeOutput =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_invoke(it, FfiConverterTypeInvokeInput.lower(`input`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_invoke(it, FfiConverterTypeInvokeInput.lower(`input`), _status)
} }
}.let { }.let {
FfiConverterTypeInvokeOutput.lift(it) FfiConverterTypeInvokeOutput.lift(it)
...@@ -804,7 +804,7 @@ class NativeSocketBuilder( ...@@ -804,7 +804,7 @@ class NativeSocketBuilder(
constructor() : constructor() :
this( this(
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_new( _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_new( _status)
}) })
/** /**
...@@ -817,14 +817,14 @@ class NativeSocketBuilder( ...@@ -817,14 +817,14 @@ class NativeSocketBuilder(
*/ */
override protected fun freeRustArcPtr() { override protected fun freeRustArcPtr() {
rustCall() { status -> rustCall() { status ->
_UniFFILib.INSTANCE.ffi_NativeSocket_2c48_NativeSocketBuilder_object_free(this.pointer, status) _UniFFILib.INSTANCE.ffi_NativeSocket_8561_NativeSocketBuilder_object_free(this.pointer, status)
} }
} }
override fun `host`(`host`: String): NativeSocketBuilder = override fun `host`(`host`: String): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_host(it, FfiConverterString.lower(`host`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_host(it, FfiConverterString.lower(`host`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -832,7 +832,7 @@ class NativeSocketBuilder( ...@@ -832,7 +832,7 @@ class NativeSocketBuilder(
override fun `token`(`token`: String): NativeSocketBuilder = override fun `token`(`token`: String): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_token(it, FfiConverterString.lower(`token`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_token(it, FfiConverterString.lower(`token`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -840,7 +840,7 @@ class NativeSocketBuilder( ...@@ -840,7 +840,7 @@ class NativeSocketBuilder(
override fun `brand`(`brand`: Int): NativeSocketBuilder = override fun `brand`(`brand`: Int): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_brand(it, FfiConverterInt.lower(`brand`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_brand(it, FfiConverterInt.lower(`brand`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -848,7 +848,7 @@ class NativeSocketBuilder( ...@@ -848,7 +848,7 @@ class NativeSocketBuilder(
override fun `store`(`store`: Int): NativeSocketBuilder = override fun `store`(`store`: Int): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_store(it, FfiConverterInt.lower(`store`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_store(it, FfiConverterInt.lower(`store`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -856,7 +856,7 @@ class NativeSocketBuilder( ...@@ -856,7 +856,7 @@ class NativeSocketBuilder(
override fun `device`(`device`: String): NativeSocketBuilder = override fun `device`(`device`: String): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_device(it, FfiConverterString.lower(`device`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_device(it, FfiConverterString.lower(`device`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -864,7 +864,7 @@ class NativeSocketBuilder( ...@@ -864,7 +864,7 @@ class NativeSocketBuilder(
override fun `ty`(`type`: Int): NativeSocketBuilder = override fun `ty`(`type`: Int): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_ty(it, FfiConverterInt.lower(`type`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_ty(it, FfiConverterInt.lower(`type`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -872,7 +872,7 @@ class NativeSocketBuilder( ...@@ -872,7 +872,7 @@ class NativeSocketBuilder(
override fun `cleanStart`(`cleanStart`: Boolean): NativeSocketBuilder = override fun `cleanStart`(`cleanStart`: Boolean): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_clean_start(it, FfiConverterBoolean.lower(`cleanStart`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_clean_start(it, FfiConverterBoolean.lower(`cleanStart`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -880,7 +880,7 @@ class NativeSocketBuilder( ...@@ -880,7 +880,7 @@ class NativeSocketBuilder(
override fun `cacheDir`(`cacheDir`: String): NativeSocketBuilder = override fun `cacheDir`(`cacheDir`: String): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_cache_dir(it, FfiConverterString.lower(`cacheDir`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_cache_dir(it, FfiConverterString.lower(`cacheDir`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -888,7 +888,7 @@ class NativeSocketBuilder( ...@@ -888,7 +888,7 @@ class NativeSocketBuilder(
override fun `logLevel`(`logLevel`: LogLevel): NativeSocketBuilder = override fun `logLevel`(`logLevel`: LogLevel): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_log_level(it, FfiConverterTypeLogLevel.lower(`logLevel`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_log_level(it, FfiConverterTypeLogLevel.lower(`logLevel`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -896,7 +896,7 @@ class NativeSocketBuilder( ...@@ -896,7 +896,7 @@ class NativeSocketBuilder(
override fun `version`(`version`: String): NativeSocketBuilder = override fun `version`(`version`: String): NativeSocketBuilder =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_version(it, FfiConverterString.lower(`version`), _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_version(it, FfiConverterString.lower(`version`), _status)
} }
}.let { }.let {
FfiConverterTypeNativeSocketBuilder.lift(it) FfiConverterTypeNativeSocketBuilder.lift(it)
...@@ -904,7 +904,7 @@ class NativeSocketBuilder( ...@@ -904,7 +904,7 @@ class NativeSocketBuilder(
override fun `build`(): NativeSocket? = override fun `build`(): NativeSocket? =
callWithPointer { callWithPointer {
rustCall() { _status -> rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_build(it, _status) _UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_build(it, _status)
} }
}.let { }.let {
FfiConverterOptionalTypeNativeSocket.lift(it) FfiConverterOptionalTypeNativeSocket.lift(it)
...@@ -977,6 +977,9 @@ public object FfiConverterTypeMessage: FfiConverterRustBuffer<Message> { ...@@ -977,6 +977,9 @@ public object FfiConverterTypeMessage: FfiConverterRustBuffer<Message> {
sealed class InvokeInput { sealed class InvokeInput {
data class Start(
val `cleanStart`: Boolean
) : InvokeInput()
object Stop : InvokeInput() object Stop : InvokeInput()
data class Ack( data class Ack(
...@@ -987,6 +990,8 @@ sealed class InvokeInput { ...@@ -987,6 +990,8 @@ sealed class InvokeInput {
) : InvokeInput() ) : InvokeInput()
object Online : InvokeInput() object Online : InvokeInput()
object History : InvokeInput()
...@@ -995,19 +1000,30 @@ sealed class InvokeInput { ...@@ -995,19 +1000,30 @@ sealed class InvokeInput {
public object FfiConverterTypeInvokeInput : FfiConverterRustBuffer<InvokeInput>{ public object FfiConverterTypeInvokeInput : FfiConverterRustBuffer<InvokeInput>{
override fun read(buf: ByteBuffer): InvokeInput { override fun read(buf: ByteBuffer): InvokeInput {
return when(buf.getInt()) { return when(buf.getInt()) {
1 -> InvokeInput.Stop 1 -> InvokeInput.Start(
2 -> InvokeInput.Ack( FfiConverterBoolean.read(buf),
)
2 -> InvokeInput.Stop
3 -> InvokeInput.Ack(
FfiConverterLong.read(buf), FfiConverterLong.read(buf),
) )
3 -> InvokeInput.Cache( 4 -> InvokeInput.Cache(
FfiConverterLong.read(buf), FfiConverterLong.read(buf),
) )
4 -> InvokeInput.Online 5 -> InvokeInput.Online
6 -> InvokeInput.History
else -> throw RuntimeException("invalid enum value, something is very wrong!!") else -> throw RuntimeException("invalid enum value, something is very wrong!!")
} }
} }
override fun allocationSize(value: InvokeInput) = when(value) { override fun allocationSize(value: InvokeInput) = when(value) {
is InvokeInput.Start -> {
// Add the size for the Int that specifies the variant plus the size needed for all fields
(
4
+ FfiConverterBoolean.allocationSize(value.`cleanStart`)
)
}
is InvokeInput.Stop -> { is InvokeInput.Stop -> {
// Add the size for the Int that specifies the variant plus the size needed for all fields // Add the size for the Int that specifies the variant plus the size needed for all fields
( (
...@@ -1034,26 +1050,41 @@ public object FfiConverterTypeInvokeInput : FfiConverterRustBuffer<InvokeInput>{ ...@@ -1034,26 +1050,41 @@ public object FfiConverterTypeInvokeInput : FfiConverterRustBuffer<InvokeInput>{
4 4
) )
} }
is InvokeInput.History -> {
// Add the size for the Int that specifies the variant plus the size needed for all fields
(
4
)
}
} }
override fun write(value: InvokeInput, buf: ByteBuffer) { override fun write(value: InvokeInput, buf: ByteBuffer) {
when(value) { when(value) {
is InvokeInput.Stop -> { is InvokeInput.Start -> {
buf.putInt(1) buf.putInt(1)
FfiConverterBoolean.write(value.`cleanStart`, buf)
Unit Unit
} }
is InvokeInput.Ack -> { is InvokeInput.Stop -> {
buf.putInt(2) buf.putInt(2)
Unit
}
is InvokeInput.Ack -> {
buf.putInt(3)
FfiConverterLong.write(value.`messageId`, buf) FfiConverterLong.write(value.`messageId`, buf)
Unit Unit
} }
is InvokeInput.Cache -> { is InvokeInput.Cache -> {
buf.putInt(3) buf.putInt(4)
FfiConverterLong.write(value.`messageId`, buf) FfiConverterLong.write(value.`messageId`, buf)
Unit Unit
} }
is InvokeInput.Online -> { is InvokeInput.Online -> {
buf.putInt(4) buf.putInt(5)
Unit
}
is InvokeInput.History -> {
buf.putInt(6)
Unit Unit
} }
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
...@@ -1074,6 +1105,9 @@ sealed class InvokeOutput { ...@@ -1074,6 +1105,9 @@ sealed class InvokeOutput {
data class Online( data class Online(
val `status`: Boolean val `status`: Boolean
) : InvokeOutput() ) : InvokeOutput()
data class History(
val `count`: Int
) : InvokeOutput()
...@@ -1089,6 +1123,9 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput ...@@ -1089,6 +1123,9 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
3 -> InvokeOutput.Online( 3 -> InvokeOutput.Online(
FfiConverterBoolean.read(buf), FfiConverterBoolean.read(buf),
) )
4 -> InvokeOutput.History(
FfiConverterInt.read(buf),
)
else -> throw RuntimeException("invalid enum value, something is very wrong!!") else -> throw RuntimeException("invalid enum value, something is very wrong!!")
} }
} }
...@@ -1114,6 +1151,13 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput ...@@ -1114,6 +1151,13 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
+ FfiConverterBoolean.allocationSize(value.`status`) + FfiConverterBoolean.allocationSize(value.`status`)
) )
} }
is InvokeOutput.History -> {
// Add the size for the Int that specifies the variant plus the size needed for all fields
(
4
+ FfiConverterInt.allocationSize(value.`count`)
)
}
} }
override fun write(value: InvokeOutput, buf: ByteBuffer) { override fun write(value: InvokeOutput, buf: ByteBuffer) {
...@@ -1132,6 +1176,11 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput ...@@ -1132,6 +1176,11 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
FfiConverterBoolean.write(value.`status`, buf) FfiConverterBoolean.write(value.`status`, buf)
Unit Unit
} }
is InvokeOutput.History -> {
buf.putInt(4)
FfiConverterInt.write(value.`count`, buf)
Unit
}
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment