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

update

parent 355c23af
......@@ -42,7 +42,7 @@ dependencies {
def USERNAME = "lizhaofa"
def PASSWORD = "0oh7bcnZtweAo7EX"
def VERSION = "1.0.11"
def VERSION = "1.0.12"
def RELEASE_REPOSITORY_URL = "https://hub.zmcms.cn/repository/maven-releases"
afterEvaluate {
......
......@@ -42,7 +42,7 @@ open class RustBuffer : Structure() {
companion object {
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) {
throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
}
......@@ -50,7 +50,7 @@ open class RustBuffer : Structure() {
}
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 {
}
}
fun ffi_NativeSocket_2c48_NativeSocketBuilder_object_free(`ptr`: Pointer,
fun ffi_NativeSocket_8561_NativeSocketBuilder_object_free(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus
): Unit
fun NativeSocket_2c48_NativeSocketBuilder_new(
fun NativeSocket_8561_NativeSocketBuilder_new(
_uniffi_out_err: RustCallStatus
): 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
): 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
): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_brand(`ptr`: Pointer,`brand`: Int,
fun NativeSocket_8561_NativeSocketBuilder_brand(`ptr`: Pointer,`brand`: Int,
_uniffi_out_err: RustCallStatus
): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_store(`ptr`: Pointer,`store`: Int,
fun NativeSocket_8561_NativeSocketBuilder_store(`ptr`: Pointer,`store`: Int,
_uniffi_out_err: RustCallStatus
): 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
): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_ty(`ptr`: Pointer,`type`: Int,
fun NativeSocket_8561_NativeSocketBuilder_ty(`ptr`: Pointer,`type`: Int,
_uniffi_out_err: RustCallStatus
): 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
): 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
): 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
): 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
): Pointer
fun NativeSocket_2c48_NativeSocketBuilder_build(`ptr`: Pointer,
fun NativeSocket_8561_NativeSocketBuilder_build(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus
): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_NativeSocket_object_free(`ptr`: Pointer,
fun ffi_NativeSocket_8561_NativeSocket_object_free(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus
): Unit
fun NativeSocket_2c48_NativeSocket_poll(`ptr`: Pointer,
fun NativeSocket_8561_NativeSocket_poll(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus
): RustBuffer.ByValue
fun NativeSocket_2c48_NativeSocket_try_poll(`ptr`: Pointer,
fun NativeSocket_8561_NativeSocket_try_poll(`ptr`: Pointer,
_uniffi_out_err: RustCallStatus
): 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
): 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
): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_rustbuffer_alloc(`size`: Int,
fun ffi_NativeSocket_8561_rustbuffer_alloc(`size`: Int,
_uniffi_out_err: RustCallStatus
): 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
): RustBuffer.ByValue
fun ffi_NativeSocket_2c48_rustbuffer_free(`buf`: RustBuffer.ByValue,
fun ffi_NativeSocket_8561_rustbuffer_free(`buf`: RustBuffer.ByValue,
_uniffi_out_err: RustCallStatus
): 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
): RustBuffer.ByValue
......@@ -706,14 +706,14 @@ class NativeSocket(
*/
override protected fun freeRustArcPtr() {
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? =
callWithPointer {
rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_poll(it, _status)
_UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_poll(it, _status)
}
}.let {
FfiConverterOptionalTypeMessage.lift(it)
......@@ -721,7 +721,7 @@ class NativeSocket(
override fun `tryPoll`(): Message? =
callWithPointer {
rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocket_try_poll(it, _status)
_UniFFILib.INSTANCE.NativeSocket_8561_NativeSocket_try_poll(it, _status)
}
}.let {
FfiConverterOptionalTypeMessage.lift(it)
......@@ -729,7 +729,7 @@ class NativeSocket(
override fun `pollTimeout`(`timeout`: java.time.Duration): Message? =
callWithPointer {
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 {
FfiConverterOptionalTypeMessage.lift(it)
......@@ -737,7 +737,7 @@ class NativeSocket(
override fun `invoke`(`input`: InvokeInput): InvokeOutput =
callWithPointer {
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 {
FfiConverterTypeInvokeOutput.lift(it)
......@@ -804,7 +804,7 @@ class NativeSocketBuilder(
constructor() :
this(
rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_new( _status)
_UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_new( _status)
})
/**
......@@ -817,14 +817,14 @@ class NativeSocketBuilder(
*/
override protected fun freeRustArcPtr() {
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 =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -832,7 +832,7 @@ class NativeSocketBuilder(
override fun `token`(`token`: String): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -840,7 +840,7 @@ class NativeSocketBuilder(
override fun `brand`(`brand`: Int): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -848,7 +848,7 @@ class NativeSocketBuilder(
override fun `store`(`store`: Int): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -856,7 +856,7 @@ class NativeSocketBuilder(
override fun `device`(`device`: String): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -864,7 +864,7 @@ class NativeSocketBuilder(
override fun `ty`(`type`: Int): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -872,7 +872,7 @@ class NativeSocketBuilder(
override fun `cleanStart`(`cleanStart`: Boolean): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -880,7 +880,7 @@ class NativeSocketBuilder(
override fun `cacheDir`(`cacheDir`: String): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -888,7 +888,7 @@ class NativeSocketBuilder(
override fun `logLevel`(`logLevel`: LogLevel): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -896,7 +896,7 @@ class NativeSocketBuilder(
override fun `version`(`version`: String): NativeSocketBuilder =
callWithPointer {
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 {
FfiConverterTypeNativeSocketBuilder.lift(it)
......@@ -904,7 +904,7 @@ class NativeSocketBuilder(
override fun `build`(): NativeSocket? =
callWithPointer {
rustCall() { _status ->
_UniFFILib.INSTANCE.NativeSocket_2c48_NativeSocketBuilder_build(it, _status)
_UniFFILib.INSTANCE.NativeSocket_8561_NativeSocketBuilder_build(it, _status)
}
}.let {
FfiConverterOptionalTypeNativeSocket.lift(it)
......@@ -977,6 +977,9 @@ public object FfiConverterTypeMessage: FfiConverterRustBuffer<Message> {
sealed class InvokeInput {
data class Start(
val `cleanStart`: Boolean
) : InvokeInput()
object Stop : InvokeInput()
data class Ack(
......@@ -987,6 +990,8 @@ sealed class InvokeInput {
) : InvokeInput()
object Online : InvokeInput()
object History : InvokeInput()
......@@ -995,19 +1000,30 @@ sealed class InvokeInput {
public object FfiConverterTypeInvokeInput : FfiConverterRustBuffer<InvokeInput>{
override fun read(buf: ByteBuffer): InvokeInput {
return when(buf.getInt()) {
1 -> InvokeInput.Stop
2 -> InvokeInput.Ack(
1 -> InvokeInput.Start(
FfiConverterBoolean.read(buf),
)
2 -> InvokeInput.Stop
3 -> InvokeInput.Ack(
FfiConverterLong.read(buf),
)
3 -> InvokeInput.Cache(
4 -> InvokeInput.Cache(
FfiConverterLong.read(buf),
)
4 -> InvokeInput.Online
5 -> InvokeInput.Online
6 -> InvokeInput.History
else -> throw RuntimeException("invalid enum value, something is very wrong!!")
}
}
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 -> {
// 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>{
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) {
when(value) {
is InvokeInput.Stop -> {
is InvokeInput.Start -> {
buf.putInt(1)
FfiConverterBoolean.write(value.`cleanStart`, buf)
Unit
}
is InvokeInput.Ack -> {
is InvokeInput.Stop -> {
buf.putInt(2)
Unit
}
is InvokeInput.Ack -> {
buf.putInt(3)
FfiConverterLong.write(value.`messageId`, buf)
Unit
}
is InvokeInput.Cache -> {
buf.putInt(3)
buf.putInt(4)
FfiConverterLong.write(value.`messageId`, buf)
Unit
}
is InvokeInput.Online -> {
buf.putInt(4)
buf.putInt(5)
Unit
}
is InvokeInput.History -> {
buf.putInt(6)
Unit
}
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
......@@ -1074,6 +1105,9 @@ sealed class InvokeOutput {
data class Online(
val `status`: Boolean
) : InvokeOutput()
data class History(
val `count`: Int
) : InvokeOutput()
......@@ -1089,6 +1123,9 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
3 -> InvokeOutput.Online(
FfiConverterBoolean.read(buf),
)
4 -> InvokeOutput.History(
FfiConverterInt.read(buf),
)
else -> throw RuntimeException("invalid enum value, something is very wrong!!")
}
}
......@@ -1114,6 +1151,13 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
+ 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) {
......@@ -1132,6 +1176,11 @@ public object FfiConverterTypeInvokeOutput : FfiConverterRustBuffer<InvokeOutput
FfiConverterBoolean.write(value.`status`, buf)
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 */ }
}
}
......
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