Live video on the AT Protocol

iroh: weird linker fix for go test

+8 -2967
+7
pkg/iroh/generated/iroh_streamplace/deps.go
··· 1 + package iroh_streamplace 2 + 3 + // This file exists because Go tests seem to be linking the tests in the wrong order 4 + // doing it like this makes sure -lm is linked before the Rust code that needs it 5 + 6 + // #cgo LDFLAGS: -lm 7 + import "C"
+1 -1
pkg/iroh/iroh_streamplace.go
··· 4 4 _ "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" 5 5 ) 6 6 7 - // #cgo LDFLAGS: -lm 8 7 // #cgo pkg-config: streamplacedeps-uninstalled 8 + // #cgo LDFLAGS: -lm 9 9 // #cgo darwin LDFLAGS: -framework Security -framework SystemConfiguration 10 10 import "C"
-1992
rust/iroh-streamplace/pkg/iroh_streamplace/generated/iroh_streamplace/iroh_streamplace.go
··· 1 - package iroh_streamplace 2 - 3 - // #include <iroh_streamplace.h> 4 - import "C" 5 - 6 - import ( 7 - "bytes" 8 - "encoding/binary" 9 - "fmt" 10 - "io" 11 - "math" 12 - "runtime" 13 - "runtime/cgo" 14 - "sync" 15 - "sync/atomic" 16 - "unsafe" 17 - ) 18 - 19 - // This is needed, because as of go 1.24 20 - // type RustBuffer C.RustBuffer cannot have methods, 21 - // RustBuffer is treated as non-local type 22 - type GoRustBuffer struct { 23 - inner C.RustBuffer 24 - } 25 - 26 - type RustBufferI interface { 27 - AsReader() *bytes.Reader 28 - Free() 29 - ToGoBytes() []byte 30 - Data() unsafe.Pointer 31 - Len() uint64 32 - Capacity() uint64 33 - } 34 - 35 - func RustBufferFromExternal(b RustBufferI) GoRustBuffer { 36 - return GoRustBuffer{ 37 - inner: C.RustBuffer{ 38 - capacity: C.uint64_t(b.Capacity()), 39 - len: C.uint64_t(b.Len()), 40 - data: (*C.uchar)(b.Data()), 41 - }, 42 - } 43 - } 44 - 45 - func (cb GoRustBuffer) Capacity() uint64 { 46 - return uint64(cb.inner.capacity) 47 - } 48 - 49 - func (cb GoRustBuffer) Len() uint64 { 50 - return uint64(cb.inner.len) 51 - } 52 - 53 - func (cb GoRustBuffer) Data() unsafe.Pointer { 54 - return unsafe.Pointer(cb.inner.data) 55 - } 56 - 57 - func (cb GoRustBuffer) AsReader() *bytes.Reader { 58 - b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) 59 - return bytes.NewReader(b) 60 - } 61 - 62 - func (cb GoRustBuffer) Free() { 63 - rustCall(func(status *C.RustCallStatus) bool { 64 - C.ffi_iroh_streamplace_rustbuffer_free(cb.inner, status) 65 - return false 66 - }) 67 - } 68 - 69 - func (cb GoRustBuffer) ToGoBytes() []byte { 70 - return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) 71 - } 72 - 73 - func stringToRustBuffer(str string) C.RustBuffer { 74 - return bytesToRustBuffer([]byte(str)) 75 - } 76 - 77 - func bytesToRustBuffer(b []byte) C.RustBuffer { 78 - if len(b) == 0 { 79 - return C.RustBuffer{} 80 - } 81 - // We can pass the pointer along here, as it is pinned 82 - // for the duration of this call 83 - foreign := C.ForeignBytes{ 84 - len: C.int(len(b)), 85 - data: (*C.uchar)(unsafe.Pointer(&b[0])), 86 - } 87 - 88 - return rustCall(func(status *C.RustCallStatus) C.RustBuffer { 89 - return C.ffi_iroh_streamplace_rustbuffer_from_bytes(foreign, status) 90 - }) 91 - } 92 - 93 - type BufLifter[GoType any] interface { 94 - Lift(value RustBufferI) GoType 95 - } 96 - 97 - type BufLowerer[GoType any] interface { 98 - Lower(value GoType) C.RustBuffer 99 - } 100 - 101 - type BufReader[GoType any] interface { 102 - Read(reader io.Reader) GoType 103 - } 104 - 105 - type BufWriter[GoType any] interface { 106 - Write(writer io.Writer, value GoType) 107 - } 108 - 109 - func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { 110 - // This might be not the most efficient way but it does not require knowing allocation size 111 - // beforehand 112 - var buffer bytes.Buffer 113 - bufWriter.Write(&buffer, value) 114 - 115 - bytes, err := io.ReadAll(&buffer) 116 - if err != nil { 117 - panic(fmt.Errorf("reading written data: %w", err)) 118 - } 119 - return bytesToRustBuffer(bytes) 120 - } 121 - 122 - func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBufferI) GoType { 123 - defer rbuf.Free() 124 - reader := rbuf.AsReader() 125 - item := bufReader.Read(reader) 126 - if reader.Len() > 0 { 127 - // TODO: Remove this 128 - leftover, _ := io.ReadAll(reader) 129 - panic(fmt.Errorf("Junk remaining in buffer after lifting: %s", string(leftover))) 130 - } 131 - return item 132 - } 133 - 134 - func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { 135 - var status C.RustCallStatus 136 - returnValue := callback(&status) 137 - err := checkCallStatus(converter, status) 138 - return returnValue, err 139 - } 140 - 141 - func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { 142 - switch status.code { 143 - case 0: 144 - return nil 145 - case 1: 146 - return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) 147 - case 2: 148 - // when the rust code sees a panic, it tries to construct a rustBuffer 149 - // with the message. but if that code panics, then it just sends back 150 - // an empty buffer. 151 - if status.errorBuf.len > 0 { 152 - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) 153 - } else { 154 - panic(fmt.Errorf("Rust panicked while handling Rust panic")) 155 - } 156 - default: 157 - panic(fmt.Errorf("unknown status code: %d", status.code)) 158 - } 159 - } 160 - 161 - func checkCallStatusUnknown(status C.RustCallStatus) error { 162 - switch status.code { 163 - case 0: 164 - return nil 165 - case 1: 166 - panic(fmt.Errorf("function not returning an error returned an error")) 167 - case 2: 168 - // when the rust code sees a panic, it tries to construct a C.RustBuffer 169 - // with the message. but if that code panics, then it just sends back 170 - // an empty buffer. 171 - if status.errorBuf.len > 0 { 172 - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ 173 - inner: status.errorBuf, 174 - }))) 175 - } else { 176 - panic(fmt.Errorf("Rust panicked while handling Rust panic")) 177 - } 178 - default: 179 - return fmt.Errorf("unknown status code: %d", status.code) 180 - } 181 - } 182 - 183 - func rustCall[U any](callback func(*C.RustCallStatus) U) U { 184 - returnValue, err := rustCallWithError[error](nil, callback) 185 - if err != nil { 186 - panic(err) 187 - } 188 - return returnValue 189 - } 190 - 191 - type NativeError interface { 192 - AsError() error 193 - } 194 - 195 - func writeInt8(writer io.Writer, value int8) { 196 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 197 - panic(err) 198 - } 199 - } 200 - 201 - func writeUint8(writer io.Writer, value uint8) { 202 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 203 - panic(err) 204 - } 205 - } 206 - 207 - func writeInt16(writer io.Writer, value int16) { 208 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 209 - panic(err) 210 - } 211 - } 212 - 213 - func writeUint16(writer io.Writer, value uint16) { 214 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 215 - panic(err) 216 - } 217 - } 218 - 219 - func writeInt32(writer io.Writer, value int32) { 220 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 221 - panic(err) 222 - } 223 - } 224 - 225 - func writeUint32(writer io.Writer, value uint32) { 226 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 227 - panic(err) 228 - } 229 - } 230 - 231 - func writeInt64(writer io.Writer, value int64) { 232 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 233 - panic(err) 234 - } 235 - } 236 - 237 - func writeUint64(writer io.Writer, value uint64) { 238 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 239 - panic(err) 240 - } 241 - } 242 - 243 - func writeFloat32(writer io.Writer, value float32) { 244 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 245 - panic(err) 246 - } 247 - } 248 - 249 - func writeFloat64(writer io.Writer, value float64) { 250 - if err := binary.Write(writer, binary.BigEndian, value); err != nil { 251 - panic(err) 252 - } 253 - } 254 - 255 - func readInt8(reader io.Reader) int8 { 256 - var result int8 257 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 258 - panic(err) 259 - } 260 - return result 261 - } 262 - 263 - func readUint8(reader io.Reader) uint8 { 264 - var result uint8 265 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 266 - panic(err) 267 - } 268 - return result 269 - } 270 - 271 - func readInt16(reader io.Reader) int16 { 272 - var result int16 273 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 274 - panic(err) 275 - } 276 - return result 277 - } 278 - 279 - func readUint16(reader io.Reader) uint16 { 280 - var result uint16 281 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 282 - panic(err) 283 - } 284 - return result 285 - } 286 - 287 - func readInt32(reader io.Reader) int32 { 288 - var result int32 289 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 290 - panic(err) 291 - } 292 - return result 293 - } 294 - 295 - func readUint32(reader io.Reader) uint32 { 296 - var result uint32 297 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 298 - panic(err) 299 - } 300 - return result 301 - } 302 - 303 - func readInt64(reader io.Reader) int64 { 304 - var result int64 305 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 306 - panic(err) 307 - } 308 - return result 309 - } 310 - 311 - func readUint64(reader io.Reader) uint64 { 312 - var result uint64 313 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 314 - panic(err) 315 - } 316 - return result 317 - } 318 - 319 - func readFloat32(reader io.Reader) float32 { 320 - var result float32 321 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 322 - panic(err) 323 - } 324 - return result 325 - } 326 - 327 - func readFloat64(reader io.Reader) float64 { 328 - var result float64 329 - if err := binary.Read(reader, binary.BigEndian, &result); err != nil { 330 - panic(err) 331 - } 332 - return result 333 - } 334 - 335 - func init() { 336 - 337 - FfiConverterDataHandlerINSTANCE.register() 338 - uniffiCheckChecksums() 339 - } 340 - 341 - func uniffiCheckChecksums() { 342 - // Get the bindings contract version from our ComponentInterface 343 - bindingsContractVersion := 26 344 - // Get the scaffolding contract version by calling the into the dylib 345 - scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { 346 - return C.ffi_iroh_streamplace_uniffi_contract_version() 347 - }) 348 - if bindingsContractVersion != int(scaffoldingContractVersion) { 349 - // If this happens try cleaning and rebuilding your project 350 - panic("iroh_streamplace: UniFFI contract version mismatch") 351 - } 352 - { 353 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 354 - return C.uniffi_iroh_streamplace_checksum_method_datahandler_handle_data() 355 - }) 356 - if checksum != 61779 { 357 - // If this happens try cleaning and rebuilding your project 358 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_datahandler_handle_data: UniFFI API checksum mismatch") 359 - } 360 - } 361 - { 362 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 363 - return C.uniffi_iroh_streamplace_checksum_method_endpoint_node_addr() 364 - }) 365 - if checksum != 17254 { 366 - // If this happens try cleaning and rebuilding your project 367 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_endpoint_node_addr: UniFFI API checksum mismatch") 368 - } 369 - } 370 - { 371 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 372 - return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_direct_addresses() 373 - }) 374 - if checksum != 17536 { 375 - // If this happens try cleaning and rebuilding your project 376 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_direct_addresses: UniFFI API checksum mismatch") 377 - } 378 - } 379 - { 380 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 381 - return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_equal() 382 - }) 383 - if checksum != 15520 { 384 - // If this happens try cleaning and rebuilding your project 385 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_equal: UniFFI API checksum mismatch") 386 - } 387 - } 388 - { 389 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 390 - return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_node_id() 391 - }) 392 - if checksum != 35476 { 393 - // If this happens try cleaning and rebuilding your project 394 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_node_id: UniFFI API checksum mismatch") 395 - } 396 - } 397 - { 398 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 399 - return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_relay_url() 400 - }) 401 - if checksum != 18967 { 402 - // If this happens try cleaning and rebuilding your project 403 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_relay_url: UniFFI API checksum mismatch") 404 - } 405 - } 406 - { 407 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 408 - return C.uniffi_iroh_streamplace_checksum_method_publickey_equal() 409 - }) 410 - if checksum != 25030 { 411 - // If this happens try cleaning and rebuilding your project 412 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickey_equal: UniFFI API checksum mismatch") 413 - } 414 - } 415 - { 416 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 417 - return C.uniffi_iroh_streamplace_checksum_method_publickey_fmt_short() 418 - }) 419 - if checksum != 57639 { 420 - // If this happens try cleaning and rebuilding your project 421 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickey_fmt_short: UniFFI API checksum mismatch") 422 - } 423 - } 424 - { 425 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 426 - return C.uniffi_iroh_streamplace_checksum_method_publickey_to_bytes() 427 - }) 428 - if checksum != 8223 { 429 - // If this happens try cleaning and rebuilding your project 430 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickey_to_bytes: UniFFI API checksum mismatch") 431 - } 432 - } 433 - { 434 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 435 - return C.uniffi_iroh_streamplace_checksum_method_receiver_node_addr() 436 - }) 437 - if checksum != 10730 { 438 - // If this happens try cleaning and rebuilding your project 439 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_receiver_node_addr: UniFFI API checksum mismatch") 440 - } 441 - } 442 - { 443 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 444 - return C.uniffi_iroh_streamplace_checksum_method_sender_add_peer() 445 - }) 446 - if checksum != 34321 { 447 - // If this happens try cleaning and rebuilding your project 448 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_sender_add_peer: UniFFI API checksum mismatch") 449 - } 450 - } 451 - { 452 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 453 - return C.uniffi_iroh_streamplace_checksum_method_sender_node_addr() 454 - }) 455 - if checksum != 38541 { 456 - // If this happens try cleaning and rebuilding your project 457 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_sender_node_addr: UniFFI API checksum mismatch") 458 - } 459 - } 460 - { 461 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 462 - return C.uniffi_iroh_streamplace_checksum_method_sender_send() 463 - }) 464 - if checksum != 24369 { 465 - // If this happens try cleaning and rebuilding your project 466 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_sender_send: UniFFI API checksum mismatch") 467 - } 468 - } 469 - { 470 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 471 - return C.uniffi_iroh_streamplace_checksum_constructor_endpoint_new() 472 - }) 473 - if checksum != 60672 { 474 - // If this happens try cleaning and rebuilding your project 475 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_endpoint_new: UniFFI API checksum mismatch") 476 - } 477 - } 478 - { 479 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 480 - return C.uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new() 481 - }) 482 - if checksum != 28044 { 483 - // If this happens try cleaning and rebuilding your project 484 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new: UniFFI API checksum mismatch") 485 - } 486 - } 487 - { 488 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 489 - return C.uniffi_iroh_streamplace_checksum_constructor_publickey_from_bytes() 490 - }) 491 - if checksum != 54187 { 492 - // If this happens try cleaning and rebuilding your project 493 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickey_from_bytes: UniFFI API checksum mismatch") 494 - } 495 - } 496 - { 497 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 498 - return C.uniffi_iroh_streamplace_checksum_constructor_publickey_from_string() 499 - }) 500 - if checksum != 62773 { 501 - // If this happens try cleaning and rebuilding your project 502 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickey_from_string: UniFFI API checksum mismatch") 503 - } 504 - } 505 - { 506 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 507 - return C.uniffi_iroh_streamplace_checksum_constructor_receiver_new() 508 - }) 509 - if checksum != 35153 { 510 - // If this happens try cleaning and rebuilding your project 511 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_receiver_new: UniFFI API checksum mismatch") 512 - } 513 - } 514 - { 515 - checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 516 - return C.uniffi_iroh_streamplace_checksum_constructor_sender_new() 517 - }) 518 - if checksum != 27594 { 519 - // If this happens try cleaning and rebuilding your project 520 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_sender_new: UniFFI API checksum mismatch") 521 - } 522 - } 523 - } 524 - 525 - type FfiConverterBool struct{} 526 - 527 - var FfiConverterBoolINSTANCE = FfiConverterBool{} 528 - 529 - func (FfiConverterBool) Lower(value bool) C.int8_t { 530 - if value { 531 - return C.int8_t(1) 532 - } 533 - return C.int8_t(0) 534 - } 535 - 536 - func (FfiConverterBool) Write(writer io.Writer, value bool) { 537 - if value { 538 - writeInt8(writer, 1) 539 - } else { 540 - writeInt8(writer, 0) 541 - } 542 - } 543 - 544 - func (FfiConverterBool) Lift(value C.int8_t) bool { 545 - return value != 0 546 - } 547 - 548 - func (FfiConverterBool) Read(reader io.Reader) bool { 549 - return readInt8(reader) != 0 550 - } 551 - 552 - type FfiDestroyerBool struct{} 553 - 554 - func (FfiDestroyerBool) Destroy(_ bool) {} 555 - 556 - type FfiConverterString struct{} 557 - 558 - var FfiConverterStringINSTANCE = FfiConverterString{} 559 - 560 - func (FfiConverterString) Lift(rb RustBufferI) string { 561 - defer rb.Free() 562 - reader := rb.AsReader() 563 - b, err := io.ReadAll(reader) 564 - if err != nil { 565 - panic(fmt.Errorf("reading reader: %w", err)) 566 - } 567 - return string(b) 568 - } 569 - 570 - func (FfiConverterString) Read(reader io.Reader) string { 571 - length := readInt32(reader) 572 - buffer := make([]byte, length) 573 - read_length, err := reader.Read(buffer) 574 - if err != nil { 575 - panic(err) 576 - } 577 - if read_length != int(length) { 578 - panic(fmt.Errorf("bad read length when reading string, expected %d, read %d", length, read_length)) 579 - } 580 - return string(buffer) 581 - } 582 - 583 - func (FfiConverterString) Lower(value string) C.RustBuffer { 584 - return stringToRustBuffer(value) 585 - } 586 - 587 - func (FfiConverterString) Write(writer io.Writer, value string) { 588 - if len(value) > math.MaxInt32 { 589 - panic("String is too large to fit into Int32") 590 - } 591 - 592 - writeInt32(writer, int32(len(value))) 593 - write_length, err := io.WriteString(writer, value) 594 - if err != nil { 595 - panic(err) 596 - } 597 - if write_length != len(value) { 598 - panic(fmt.Errorf("bad write length when writing string, expected %d, written %d", len(value), write_length)) 599 - } 600 - } 601 - 602 - type FfiDestroyerString struct{} 603 - 604 - func (FfiDestroyerString) Destroy(_ string) {} 605 - 606 - type FfiConverterBytes struct{} 607 - 608 - var FfiConverterBytesINSTANCE = FfiConverterBytes{} 609 - 610 - func (c FfiConverterBytes) Lower(value []byte) C.RustBuffer { 611 - return LowerIntoRustBuffer[[]byte](c, value) 612 - } 613 - 614 - func (c FfiConverterBytes) Write(writer io.Writer, value []byte) { 615 - if len(value) > math.MaxInt32 { 616 - panic("[]byte is too large to fit into Int32") 617 - } 618 - 619 - writeInt32(writer, int32(len(value))) 620 - write_length, err := writer.Write(value) 621 - if err != nil { 622 - panic(err) 623 - } 624 - if write_length != len(value) { 625 - panic(fmt.Errorf("bad write length when writing []byte, expected %d, written %d", len(value), write_length)) 626 - } 627 - } 628 - 629 - func (c FfiConverterBytes) Lift(rb RustBufferI) []byte { 630 - return LiftFromRustBuffer[[]byte](c, rb) 631 - } 632 - 633 - func (c FfiConverterBytes) Read(reader io.Reader) []byte { 634 - length := readInt32(reader) 635 - buffer := make([]byte, length) 636 - read_length, err := reader.Read(buffer) 637 - if err != nil { 638 - panic(err) 639 - } 640 - if read_length != int(length) { 641 - panic(fmt.Errorf("bad read length when reading []byte, expected %d, read %d", length, read_length)) 642 - } 643 - return buffer 644 - } 645 - 646 - type FfiDestroyerBytes struct{} 647 - 648 - func (FfiDestroyerBytes) Destroy(_ []byte) {} 649 - 650 - // Below is an implementation of synchronization requirements outlined in the link. 651 - // https://github.com/mozilla/uniffi-rs/blob/0dc031132d9493ca812c3af6e7dd60ad2ea95bf0/uniffi_bindgen/src/bindings/kotlin/templates/ObjectRuntime.kt#L31 652 - 653 - type FfiObject struct { 654 - pointer unsafe.Pointer 655 - callCounter atomic.Int64 656 - cloneFunction func(unsafe.Pointer, *C.RustCallStatus) unsafe.Pointer 657 - freeFunction func(unsafe.Pointer, *C.RustCallStatus) 658 - destroyed atomic.Bool 659 - } 660 - 661 - func newFfiObject( 662 - pointer unsafe.Pointer, 663 - cloneFunction func(unsafe.Pointer, *C.RustCallStatus) unsafe.Pointer, 664 - freeFunction func(unsafe.Pointer, *C.RustCallStatus), 665 - ) FfiObject { 666 - return FfiObject{ 667 - pointer: pointer, 668 - cloneFunction: cloneFunction, 669 - freeFunction: freeFunction, 670 - } 671 - } 672 - 673 - func (ffiObject *FfiObject) incrementPointer(debugName string) unsafe.Pointer { 674 - for { 675 - counter := ffiObject.callCounter.Load() 676 - if counter <= -1 { 677 - panic(fmt.Errorf("%v object has already been destroyed", debugName)) 678 - } 679 - if counter == math.MaxInt64 { 680 - panic(fmt.Errorf("%v object call counter would overflow", debugName)) 681 - } 682 - if ffiObject.callCounter.CompareAndSwap(counter, counter+1) { 683 - break 684 - } 685 - } 686 - 687 - return rustCall(func(status *C.RustCallStatus) unsafe.Pointer { 688 - return ffiObject.cloneFunction(ffiObject.pointer, status) 689 - }) 690 - } 691 - 692 - func (ffiObject *FfiObject) decrementPointer() { 693 - if ffiObject.callCounter.Add(-1) == -1 { 694 - ffiObject.freeRustArcPtr() 695 - } 696 - } 697 - 698 - func (ffiObject *FfiObject) destroy() { 699 - if ffiObject.destroyed.CompareAndSwap(false, true) { 700 - if ffiObject.callCounter.Add(-1) == -1 { 701 - ffiObject.freeRustArcPtr() 702 - } 703 - } 704 - } 705 - 706 - func (ffiObject *FfiObject) freeRustArcPtr() { 707 - rustCall(func(status *C.RustCallStatus) int32 { 708 - ffiObject.freeFunction(ffiObject.pointer, status) 709 - return 0 710 - }) 711 - } 712 - 713 - type DataHandler interface { 714 - HandleData(peer *PublicKey, data []byte) 715 - } 716 - type DataHandlerImpl struct { 717 - ffiObject FfiObject 718 - } 719 - 720 - func (_self *DataHandlerImpl) HandleData(peer *PublicKey, data []byte) { 721 - _pointer := _self.ffiObject.incrementPointer("DataHandler") 722 - defer _self.ffiObject.decrementPointer() 723 - uniffiRustCallAsync[struct{}]( 724 - nil, 725 - // completeFn 726 - func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 727 - C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 728 - return struct{}{} 729 - }, 730 - // liftFn 731 - func(_ struct{}) struct{} { return struct{}{} }, 732 - C.uniffi_iroh_streamplace_fn_method_datahandler_handle_data( 733 - _pointer, FfiConverterPublicKeyINSTANCE.Lower(peer), FfiConverterBytesINSTANCE.Lower(data)), 734 - // pollFn 735 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 736 - C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 737 - }, 738 - // freeFn 739 - func(handle C.uint64_t) { 740 - C.ffi_iroh_streamplace_rust_future_free_void(handle) 741 - }, 742 - ) 743 - 744 - } 745 - func (object *DataHandlerImpl) Destroy() { 746 - runtime.SetFinalizer(object, nil) 747 - object.ffiObject.destroy() 748 - } 749 - 750 - type FfiConverterDataHandler struct { 751 - handleMap *concurrentHandleMap[DataHandler] 752 - } 753 - 754 - var FfiConverterDataHandlerINSTANCE = FfiConverterDataHandler{ 755 - handleMap: newConcurrentHandleMap[DataHandler](), 756 - } 757 - 758 - func (c FfiConverterDataHandler) Lift(pointer unsafe.Pointer) DataHandler { 759 - result := &DataHandlerImpl{ 760 - newFfiObject( 761 - pointer, 762 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 763 - return C.uniffi_iroh_streamplace_fn_clone_datahandler(pointer, status) 764 - }, 765 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 766 - C.uniffi_iroh_streamplace_fn_free_datahandler(pointer, status) 767 - }, 768 - ), 769 - } 770 - runtime.SetFinalizer(result, (*DataHandlerImpl).Destroy) 771 - return result 772 - } 773 - 774 - func (c FfiConverterDataHandler) Read(reader io.Reader) DataHandler { 775 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 776 - } 777 - 778 - func (c FfiConverterDataHandler) Lower(value DataHandler) unsafe.Pointer { 779 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 780 - // because the pointer will be decremented immediately after this function returns, 781 - // and someone will be left holding onto a non-locked pointer. 782 - pointer := unsafe.Pointer(uintptr(c.handleMap.insert(value))) 783 - return pointer 784 - 785 - } 786 - 787 - func (c FfiConverterDataHandler) Write(writer io.Writer, value DataHandler) { 788 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 789 - } 790 - 791 - type FfiDestroyerDataHandler struct{} 792 - 793 - func (_ FfiDestroyerDataHandler) Destroy(value DataHandler) { 794 - if val, ok := value.(*DataHandlerImpl); ok { 795 - val.Destroy() 796 - } else { 797 - panic("Expected *DataHandlerImpl") 798 - } 799 - } 800 - 801 - type uniffiCallbackResult C.int8_t 802 - 803 - const ( 804 - uniffiIdxCallbackFree uniffiCallbackResult = 0 805 - uniffiCallbackResultSuccess uniffiCallbackResult = 0 806 - uniffiCallbackResultError uniffiCallbackResult = 1 807 - uniffiCallbackUnexpectedResultError uniffiCallbackResult = 2 808 - uniffiCallbackCancelled uniffiCallbackResult = 3 809 - ) 810 - 811 - type concurrentHandleMap[T any] struct { 812 - handles map[uint64]T 813 - currentHandle uint64 814 - lock sync.RWMutex 815 - } 816 - 817 - func newConcurrentHandleMap[T any]() *concurrentHandleMap[T] { 818 - return &concurrentHandleMap[T]{ 819 - handles: map[uint64]T{}, 820 - } 821 - } 822 - 823 - func (cm *concurrentHandleMap[T]) insert(obj T) uint64 { 824 - cm.lock.Lock() 825 - defer cm.lock.Unlock() 826 - 827 - cm.currentHandle = cm.currentHandle + 1 828 - cm.handles[cm.currentHandle] = obj 829 - return cm.currentHandle 830 - } 831 - 832 - func (cm *concurrentHandleMap[T]) remove(handle uint64) { 833 - cm.lock.Lock() 834 - defer cm.lock.Unlock() 835 - 836 - delete(cm.handles, handle) 837 - } 838 - 839 - func (cm *concurrentHandleMap[T]) tryGet(handle uint64) (T, bool) { 840 - cm.lock.RLock() 841 - defer cm.lock.RUnlock() 842 - 843 - val, ok := cm.handles[handle] 844 - return val, ok 845 - } 846 - 847 - //export iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0 848 - func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uniffiHandle C.uint64_t, peer unsafe.Pointer, data C.RustBuffer, uniffiFutureCallback C.UniffiForeignFutureCompleteVoid, uniffiCallbackData C.uint64_t, uniffiOutReturn *C.UniffiForeignFuture) { 849 - handle := uint64(uniffiHandle) 850 - uniffiObj, ok := FfiConverterDataHandlerINSTANCE.handleMap.tryGet(handle) 851 - if !ok { 852 - panic(fmt.Errorf("no callback in handle map: %d", handle)) 853 - } 854 - 855 - result := make(chan C.UniffiForeignFutureStructVoid, 1) 856 - cancel := make(chan struct{}, 1) 857 - guardHandle := cgo.NewHandle(cancel) 858 - *uniffiOutReturn = C.UniffiForeignFuture{ 859 - handle: C.uint64_t(guardHandle), 860 - free: C.UniffiForeignFutureFree(C.iroh_streamplace_uniffiFreeGorutine), 861 - } 862 - 863 - // Wait for compleation or cancel 864 - go func() { 865 - select { 866 - case <-cancel: 867 - case res := <-result: 868 - C.call_UniffiForeignFutureCompleteVoid(uniffiFutureCallback, uniffiCallbackData, res) 869 - } 870 - }() 871 - 872 - // Eval callback asynchroniously 873 - go func() { 874 - asyncResult := &C.UniffiForeignFutureStructVoid{} 875 - defer func() { 876 - result <- *asyncResult 877 - }() 878 - 879 - uniffiObj.HandleData( 880 - FfiConverterPublicKeyINSTANCE.Lift(peer), 881 - FfiConverterBytesINSTANCE.Lift(GoRustBuffer{ 882 - inner: data, 883 - }), 884 - ) 885 - 886 - }() 887 - } 888 - 889 - var UniffiVTableCallbackInterfaceDataHandlerINSTANCE = C.UniffiVTableCallbackInterfaceDataHandler{ 890 - handleData: (C.UniffiCallbackInterfaceDataHandlerMethod0)(C.iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0), 891 - 892 - uniffiFree: (C.UniffiCallbackInterfaceFree)(C.iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree), 893 - } 894 - 895 - //export iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree 896 - func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree(handle C.uint64_t) { 897 - FfiConverterDataHandlerINSTANCE.handleMap.remove(uint64(handle)) 898 - } 899 - 900 - func (c FfiConverterDataHandler) register() { 901 - C.uniffi_iroh_streamplace_fn_init_callback_vtable_datahandler(&UniffiVTableCallbackInterfaceDataHandlerINSTANCE) 902 - } 903 - 904 - type EndpointInterface interface { 905 - NodeAddr() *NodeAddr 906 - } 907 - type Endpoint struct { 908 - ffiObject FfiObject 909 - } 910 - 911 - // Create a new endpoint. 912 - func NewEndpoint() (*Endpoint, *Error) { 913 - res, err := uniffiRustCallAsync[Error]( 914 - FfiConverterErrorINSTANCE, 915 - // completeFn 916 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 917 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 918 - return res 919 - }, 920 - // liftFn 921 - func(ffi unsafe.Pointer) *Endpoint { 922 - return FfiConverterEndpointINSTANCE.Lift(ffi) 923 - }, 924 - C.uniffi_iroh_streamplace_fn_constructor_endpoint_new(), 925 - // pollFn 926 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 927 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 928 - }, 929 - // freeFn 930 - func(handle C.uint64_t) { 931 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 932 - }, 933 - ) 934 - 935 - return res, err 936 - } 937 - 938 - func (_self *Endpoint) NodeAddr() *NodeAddr { 939 - _pointer := _self.ffiObject.incrementPointer("*Endpoint") 940 - defer _self.ffiObject.decrementPointer() 941 - res, _ := uniffiRustCallAsync[struct{}]( 942 - nil, 943 - // completeFn 944 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 945 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 946 - return res 947 - }, 948 - // liftFn 949 - func(ffi unsafe.Pointer) *NodeAddr { 950 - return FfiConverterNodeAddrINSTANCE.Lift(ffi) 951 - }, 952 - C.uniffi_iroh_streamplace_fn_method_endpoint_node_addr( 953 - _pointer), 954 - // pollFn 955 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 956 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 957 - }, 958 - // freeFn 959 - func(handle C.uint64_t) { 960 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 961 - }, 962 - ) 963 - 964 - return res 965 - } 966 - func (object *Endpoint) Destroy() { 967 - runtime.SetFinalizer(object, nil) 968 - object.ffiObject.destroy() 969 - } 970 - 971 - type FfiConverterEndpoint struct{} 972 - 973 - var FfiConverterEndpointINSTANCE = FfiConverterEndpoint{} 974 - 975 - func (c FfiConverterEndpoint) Lift(pointer unsafe.Pointer) *Endpoint { 976 - result := &Endpoint{ 977 - newFfiObject( 978 - pointer, 979 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 980 - return C.uniffi_iroh_streamplace_fn_clone_endpoint(pointer, status) 981 - }, 982 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 983 - C.uniffi_iroh_streamplace_fn_free_endpoint(pointer, status) 984 - }, 985 - ), 986 - } 987 - runtime.SetFinalizer(result, (*Endpoint).Destroy) 988 - return result 989 - } 990 - 991 - func (c FfiConverterEndpoint) Read(reader io.Reader) *Endpoint { 992 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 993 - } 994 - 995 - func (c FfiConverterEndpoint) Lower(value *Endpoint) unsafe.Pointer { 996 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 997 - // because the pointer will be decremented immediately after this function returns, 998 - // and someone will be left holding onto a non-locked pointer. 999 - pointer := value.ffiObject.incrementPointer("*Endpoint") 1000 - defer value.ffiObject.decrementPointer() 1001 - return pointer 1002 - 1003 - } 1004 - 1005 - func (c FfiConverterEndpoint) Write(writer io.Writer, value *Endpoint) { 1006 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1007 - } 1008 - 1009 - type FfiDestroyerEndpoint struct{} 1010 - 1011 - func (_ FfiDestroyerEndpoint) Destroy(value *Endpoint) { 1012 - value.Destroy() 1013 - } 1014 - 1015 - // A peer and it's addressing information. 1016 - type NodeAddrInterface interface { 1017 - // Get the direct addresses of this peer. 1018 - DirectAddresses() []string 1019 - // Returns true if both NodeAddr's have the same values 1020 - Equal(other *NodeAddr) bool 1021 - NodeId() *PublicKey 1022 - // Get the home relay URL for this peer 1023 - RelayUrl() *string 1024 - } 1025 - 1026 - // A peer and it's addressing information. 1027 - type NodeAddr struct { 1028 - ffiObject FfiObject 1029 - } 1030 - 1031 - // Create a new [`NodeAddr`] with empty [`AddrInfo`]. 1032 - func NewNodeAddr(nodeId *PublicKey, derpUrl *string, addresses []string) *NodeAddr { 1033 - return FfiConverterNodeAddrINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1034 - return C.uniffi_iroh_streamplace_fn_constructor_nodeaddr_new(FfiConverterPublicKeyINSTANCE.Lower(nodeId), FfiConverterOptionalStringINSTANCE.Lower(derpUrl), FfiConverterSequenceStringINSTANCE.Lower(addresses), _uniffiStatus) 1035 - })) 1036 - } 1037 - 1038 - // Get the direct addresses of this peer. 1039 - func (_self *NodeAddr) DirectAddresses() []string { 1040 - _pointer := _self.ffiObject.incrementPointer("*NodeAddr") 1041 - defer _self.ffiObject.decrementPointer() 1042 - return FfiConverterSequenceStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1043 - return GoRustBuffer{ 1044 - inner: C.uniffi_iroh_streamplace_fn_method_nodeaddr_direct_addresses( 1045 - _pointer, _uniffiStatus), 1046 - } 1047 - })) 1048 - } 1049 - 1050 - // Returns true if both NodeAddr's have the same values 1051 - func (_self *NodeAddr) Equal(other *NodeAddr) bool { 1052 - _pointer := _self.ffiObject.incrementPointer("*NodeAddr") 1053 - defer _self.ffiObject.decrementPointer() 1054 - return FfiConverterBoolINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.int8_t { 1055 - return C.uniffi_iroh_streamplace_fn_method_nodeaddr_equal( 1056 - _pointer, FfiConverterNodeAddrINSTANCE.Lower(other), _uniffiStatus) 1057 - })) 1058 - } 1059 - 1060 - func (_self *NodeAddr) NodeId() *PublicKey { 1061 - _pointer := _self.ffiObject.incrementPointer("*NodeAddr") 1062 - defer _self.ffiObject.decrementPointer() 1063 - return FfiConverterPublicKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1064 - return C.uniffi_iroh_streamplace_fn_method_nodeaddr_node_id( 1065 - _pointer, _uniffiStatus) 1066 - })) 1067 - } 1068 - 1069 - // Get the home relay URL for this peer 1070 - func (_self *NodeAddr) RelayUrl() *string { 1071 - _pointer := _self.ffiObject.incrementPointer("*NodeAddr") 1072 - defer _self.ffiObject.decrementPointer() 1073 - return FfiConverterOptionalStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1074 - return GoRustBuffer{ 1075 - inner: C.uniffi_iroh_streamplace_fn_method_nodeaddr_relay_url( 1076 - _pointer, _uniffiStatus), 1077 - } 1078 - })) 1079 - } 1080 - func (object *NodeAddr) Destroy() { 1081 - runtime.SetFinalizer(object, nil) 1082 - object.ffiObject.destroy() 1083 - } 1084 - 1085 - type FfiConverterNodeAddr struct{} 1086 - 1087 - var FfiConverterNodeAddrINSTANCE = FfiConverterNodeAddr{} 1088 - 1089 - func (c FfiConverterNodeAddr) Lift(pointer unsafe.Pointer) *NodeAddr { 1090 - result := &NodeAddr{ 1091 - newFfiObject( 1092 - pointer, 1093 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1094 - return C.uniffi_iroh_streamplace_fn_clone_nodeaddr(pointer, status) 1095 - }, 1096 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1097 - C.uniffi_iroh_streamplace_fn_free_nodeaddr(pointer, status) 1098 - }, 1099 - ), 1100 - } 1101 - runtime.SetFinalizer(result, (*NodeAddr).Destroy) 1102 - return result 1103 - } 1104 - 1105 - func (c FfiConverterNodeAddr) Read(reader io.Reader) *NodeAddr { 1106 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1107 - } 1108 - 1109 - func (c FfiConverterNodeAddr) Lower(value *NodeAddr) unsafe.Pointer { 1110 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1111 - // because the pointer will be decremented immediately after this function returns, 1112 - // and someone will be left holding onto a non-locked pointer. 1113 - pointer := value.ffiObject.incrementPointer("*NodeAddr") 1114 - defer value.ffiObject.decrementPointer() 1115 - return pointer 1116 - 1117 - } 1118 - 1119 - func (c FfiConverterNodeAddr) Write(writer io.Writer, value *NodeAddr) { 1120 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1121 - } 1122 - 1123 - type FfiDestroyerNodeAddr struct{} 1124 - 1125 - func (_ FfiDestroyerNodeAddr) Destroy(value *NodeAddr) { 1126 - value.Destroy() 1127 - } 1128 - 1129 - // A public key. 1130 - // 1131 - // The key itself is just a 32 byte array, but a key has associated crypto 1132 - // information that is cached for performance reasons. 1133 - type PublicKeyInterface interface { 1134 - // Returns true if the PublicKeys are equal 1135 - Equal(other *PublicKey) bool 1136 - // Convert to a base32 string limited to the first 10 bytes for a friendly string 1137 - // representation of the key. 1138 - FmtShort() string 1139 - // Express the PublicKey as a byte array 1140 - ToBytes() []byte 1141 - } 1142 - 1143 - // A public key. 1144 - // 1145 - // The key itself is just a 32 byte array, but a key has associated crypto 1146 - // information that is cached for performance reasons. 1147 - type PublicKey struct { 1148 - ffiObject FfiObject 1149 - } 1150 - 1151 - // Make a PublicKey from byte array 1152 - func PublicKeyFromBytes(bytes []byte) (*PublicKey, *Error) { 1153 - _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1154 - return C.uniffi_iroh_streamplace_fn_constructor_publickey_from_bytes(FfiConverterBytesINSTANCE.Lower(bytes), _uniffiStatus) 1155 - }) 1156 - if _uniffiErr != nil { 1157 - var _uniffiDefaultValue *PublicKey 1158 - return _uniffiDefaultValue, _uniffiErr 1159 - } else { 1160 - return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), _uniffiErr 1161 - } 1162 - } 1163 - 1164 - // Make a PublicKey from base32 string 1165 - func PublicKeyFromString(s string) (*PublicKey, *Error) { 1166 - _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1167 - return C.uniffi_iroh_streamplace_fn_constructor_publickey_from_string(FfiConverterStringINSTANCE.Lower(s), _uniffiStatus) 1168 - }) 1169 - if _uniffiErr != nil { 1170 - var _uniffiDefaultValue *PublicKey 1171 - return _uniffiDefaultValue, _uniffiErr 1172 - } else { 1173 - return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), _uniffiErr 1174 - } 1175 - } 1176 - 1177 - // Returns true if the PublicKeys are equal 1178 - func (_self *PublicKey) Equal(other *PublicKey) bool { 1179 - _pointer := _self.ffiObject.incrementPointer("*PublicKey") 1180 - defer _self.ffiObject.decrementPointer() 1181 - return FfiConverterBoolINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.int8_t { 1182 - return C.uniffi_iroh_streamplace_fn_method_publickey_equal( 1183 - _pointer, FfiConverterPublicKeyINSTANCE.Lower(other), _uniffiStatus) 1184 - })) 1185 - } 1186 - 1187 - // Convert to a base32 string limited to the first 10 bytes for a friendly string 1188 - // representation of the key. 1189 - func (_self *PublicKey) FmtShort() string { 1190 - _pointer := _self.ffiObject.incrementPointer("*PublicKey") 1191 - defer _self.ffiObject.decrementPointer() 1192 - return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1193 - return GoRustBuffer{ 1194 - inner: C.uniffi_iroh_streamplace_fn_method_publickey_fmt_short( 1195 - _pointer, _uniffiStatus), 1196 - } 1197 - })) 1198 - } 1199 - 1200 - // Express the PublicKey as a byte array 1201 - func (_self *PublicKey) ToBytes() []byte { 1202 - _pointer := _self.ffiObject.incrementPointer("*PublicKey") 1203 - defer _self.ffiObject.decrementPointer() 1204 - return FfiConverterBytesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1205 - return GoRustBuffer{ 1206 - inner: C.uniffi_iroh_streamplace_fn_method_publickey_to_bytes( 1207 - _pointer, _uniffiStatus), 1208 - } 1209 - })) 1210 - } 1211 - 1212 - func (_self *PublicKey) String() string { 1213 - _pointer := _self.ffiObject.incrementPointer("*PublicKey") 1214 - defer _self.ffiObject.decrementPointer() 1215 - return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1216 - return GoRustBuffer{ 1217 - inner: C.uniffi_iroh_streamplace_fn_method_publickey_uniffi_trait_display( 1218 - _pointer, _uniffiStatus), 1219 - } 1220 - })) 1221 - } 1222 - 1223 - func (object *PublicKey) Destroy() { 1224 - runtime.SetFinalizer(object, nil) 1225 - object.ffiObject.destroy() 1226 - } 1227 - 1228 - type FfiConverterPublicKey struct{} 1229 - 1230 - var FfiConverterPublicKeyINSTANCE = FfiConverterPublicKey{} 1231 - 1232 - func (c FfiConverterPublicKey) Lift(pointer unsafe.Pointer) *PublicKey { 1233 - result := &PublicKey{ 1234 - newFfiObject( 1235 - pointer, 1236 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1237 - return C.uniffi_iroh_streamplace_fn_clone_publickey(pointer, status) 1238 - }, 1239 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1240 - C.uniffi_iroh_streamplace_fn_free_publickey(pointer, status) 1241 - }, 1242 - ), 1243 - } 1244 - runtime.SetFinalizer(result, (*PublicKey).Destroy) 1245 - return result 1246 - } 1247 - 1248 - func (c FfiConverterPublicKey) Read(reader io.Reader) *PublicKey { 1249 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1250 - } 1251 - 1252 - func (c FfiConverterPublicKey) Lower(value *PublicKey) unsafe.Pointer { 1253 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1254 - // because the pointer will be decremented immediately after this function returns, 1255 - // and someone will be left holding onto a non-locked pointer. 1256 - pointer := value.ffiObject.incrementPointer("*PublicKey") 1257 - defer value.ffiObject.decrementPointer() 1258 - return pointer 1259 - 1260 - } 1261 - 1262 - func (c FfiConverterPublicKey) Write(writer io.Writer, value *PublicKey) { 1263 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1264 - } 1265 - 1266 - type FfiDestroyerPublicKey struct{} 1267 - 1268 - func (_ FfiDestroyerPublicKey) Destroy(value *PublicKey) { 1269 - value.Destroy() 1270 - } 1271 - 1272 - type ReceiverInterface interface { 1273 - NodeAddr() *NodeAddr 1274 - } 1275 - type Receiver struct { 1276 - ffiObject FfiObject 1277 - } 1278 - 1279 - // Create a new receiver. 1280 - func NewReceiver(endpoint *Endpoint, handler DataHandler) (*Receiver, *Error) { 1281 - res, err := uniffiRustCallAsync[Error]( 1282 - FfiConverterErrorINSTANCE, 1283 - // completeFn 1284 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 1285 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 1286 - return res 1287 - }, 1288 - // liftFn 1289 - func(ffi unsafe.Pointer) *Receiver { 1290 - return FfiConverterReceiverINSTANCE.Lift(ffi) 1291 - }, 1292 - C.uniffi_iroh_streamplace_fn_constructor_receiver_new(FfiConverterEndpointINSTANCE.Lower(endpoint), FfiConverterDataHandlerINSTANCE.Lower(handler)), 1293 - // pollFn 1294 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1295 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 1296 - }, 1297 - // freeFn 1298 - func(handle C.uint64_t) { 1299 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 1300 - }, 1301 - ) 1302 - 1303 - return res, err 1304 - } 1305 - 1306 - func (_self *Receiver) NodeAddr() *NodeAddr { 1307 - _pointer := _self.ffiObject.incrementPointer("*Receiver") 1308 - defer _self.ffiObject.decrementPointer() 1309 - res, _ := uniffiRustCallAsync[struct{}]( 1310 - nil, 1311 - // completeFn 1312 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 1313 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 1314 - return res 1315 - }, 1316 - // liftFn 1317 - func(ffi unsafe.Pointer) *NodeAddr { 1318 - return FfiConverterNodeAddrINSTANCE.Lift(ffi) 1319 - }, 1320 - C.uniffi_iroh_streamplace_fn_method_receiver_node_addr( 1321 - _pointer), 1322 - // pollFn 1323 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1324 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 1325 - }, 1326 - // freeFn 1327 - func(handle C.uint64_t) { 1328 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 1329 - }, 1330 - ) 1331 - 1332 - return res 1333 - } 1334 - func (object *Receiver) Destroy() { 1335 - runtime.SetFinalizer(object, nil) 1336 - object.ffiObject.destroy() 1337 - } 1338 - 1339 - type FfiConverterReceiver struct{} 1340 - 1341 - var FfiConverterReceiverINSTANCE = FfiConverterReceiver{} 1342 - 1343 - func (c FfiConverterReceiver) Lift(pointer unsafe.Pointer) *Receiver { 1344 - result := &Receiver{ 1345 - newFfiObject( 1346 - pointer, 1347 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1348 - return C.uniffi_iroh_streamplace_fn_clone_receiver(pointer, status) 1349 - }, 1350 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1351 - C.uniffi_iroh_streamplace_fn_free_receiver(pointer, status) 1352 - }, 1353 - ), 1354 - } 1355 - runtime.SetFinalizer(result, (*Receiver).Destroy) 1356 - return result 1357 - } 1358 - 1359 - func (c FfiConverterReceiver) Read(reader io.Reader) *Receiver { 1360 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1361 - } 1362 - 1363 - func (c FfiConverterReceiver) Lower(value *Receiver) unsafe.Pointer { 1364 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1365 - // because the pointer will be decremented immediately after this function returns, 1366 - // and someone will be left holding onto a non-locked pointer. 1367 - pointer := value.ffiObject.incrementPointer("*Receiver") 1368 - defer value.ffiObject.decrementPointer() 1369 - return pointer 1370 - 1371 - } 1372 - 1373 - func (c FfiConverterReceiver) Write(writer io.Writer, value *Receiver) { 1374 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1375 - } 1376 - 1377 - type FfiDestroyerReceiver struct{} 1378 - 1379 - func (_ FfiDestroyerReceiver) Destroy(value *Receiver) { 1380 - value.Destroy() 1381 - } 1382 - 1383 - type SenderInterface interface { 1384 - AddPeer(addr *NodeAddr) *Error 1385 - NodeAddr() *NodeAddr 1386 - Send(nodeId *PublicKey, data []byte) *Error 1387 - } 1388 - type Sender struct { 1389 - ffiObject FfiObject 1390 - } 1391 - 1392 - // Create a new sender. 1393 - func NewSender(endpoint *Endpoint) (*Sender, *Error) { 1394 - res, err := uniffiRustCallAsync[Error]( 1395 - FfiConverterErrorINSTANCE, 1396 - // completeFn 1397 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 1398 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 1399 - return res 1400 - }, 1401 - // liftFn 1402 - func(ffi unsafe.Pointer) *Sender { 1403 - return FfiConverterSenderINSTANCE.Lift(ffi) 1404 - }, 1405 - C.uniffi_iroh_streamplace_fn_constructor_sender_new(FfiConverterEndpointINSTANCE.Lower(endpoint)), 1406 - // pollFn 1407 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1408 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 1409 - }, 1410 - // freeFn 1411 - func(handle C.uint64_t) { 1412 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 1413 - }, 1414 - ) 1415 - 1416 - return res, err 1417 - } 1418 - 1419 - func (_self *Sender) AddPeer(addr *NodeAddr) *Error { 1420 - _pointer := _self.ffiObject.incrementPointer("*Sender") 1421 - defer _self.ffiObject.decrementPointer() 1422 - _, err := uniffiRustCallAsync[Error]( 1423 - FfiConverterErrorINSTANCE, 1424 - // completeFn 1425 - func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 1426 - C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 1427 - return struct{}{} 1428 - }, 1429 - // liftFn 1430 - func(_ struct{}) struct{} { return struct{}{} }, 1431 - C.uniffi_iroh_streamplace_fn_method_sender_add_peer( 1432 - _pointer, FfiConverterNodeAddrINSTANCE.Lower(addr)), 1433 - // pollFn 1434 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1435 - C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 1436 - }, 1437 - // freeFn 1438 - func(handle C.uint64_t) { 1439 - C.ffi_iroh_streamplace_rust_future_free_void(handle) 1440 - }, 1441 - ) 1442 - 1443 - return err 1444 - } 1445 - 1446 - func (_self *Sender) NodeAddr() *NodeAddr { 1447 - _pointer := _self.ffiObject.incrementPointer("*Sender") 1448 - defer _self.ffiObject.decrementPointer() 1449 - res, _ := uniffiRustCallAsync[struct{}]( 1450 - nil, 1451 - // completeFn 1452 - func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 1453 - res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 1454 - return res 1455 - }, 1456 - // liftFn 1457 - func(ffi unsafe.Pointer) *NodeAddr { 1458 - return FfiConverterNodeAddrINSTANCE.Lift(ffi) 1459 - }, 1460 - C.uniffi_iroh_streamplace_fn_method_sender_node_addr( 1461 - _pointer), 1462 - // pollFn 1463 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1464 - C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 1465 - }, 1466 - // freeFn 1467 - func(handle C.uint64_t) { 1468 - C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 1469 - }, 1470 - ) 1471 - 1472 - return res 1473 - } 1474 - 1475 - func (_self *Sender) Send(nodeId *PublicKey, data []byte) *Error { 1476 - _pointer := _self.ffiObject.incrementPointer("*Sender") 1477 - defer _self.ffiObject.decrementPointer() 1478 - _, err := uniffiRustCallAsync[Error]( 1479 - FfiConverterErrorINSTANCE, 1480 - // completeFn 1481 - func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 1482 - C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 1483 - return struct{}{} 1484 - }, 1485 - // liftFn 1486 - func(_ struct{}) struct{} { return struct{}{} }, 1487 - C.uniffi_iroh_streamplace_fn_method_sender_send( 1488 - _pointer, FfiConverterPublicKeyINSTANCE.Lower(nodeId), FfiConverterBytesINSTANCE.Lower(data)), 1489 - // pollFn 1490 - func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1491 - C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 1492 - }, 1493 - // freeFn 1494 - func(handle C.uint64_t) { 1495 - C.ffi_iroh_streamplace_rust_future_free_void(handle) 1496 - }, 1497 - ) 1498 - 1499 - return err 1500 - } 1501 - func (object *Sender) Destroy() { 1502 - runtime.SetFinalizer(object, nil) 1503 - object.ffiObject.destroy() 1504 - } 1505 - 1506 - type FfiConverterSender struct{} 1507 - 1508 - var FfiConverterSenderINSTANCE = FfiConverterSender{} 1509 - 1510 - func (c FfiConverterSender) Lift(pointer unsafe.Pointer) *Sender { 1511 - result := &Sender{ 1512 - newFfiObject( 1513 - pointer, 1514 - func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1515 - return C.uniffi_iroh_streamplace_fn_clone_sender(pointer, status) 1516 - }, 1517 - func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1518 - C.uniffi_iroh_streamplace_fn_free_sender(pointer, status) 1519 - }, 1520 - ), 1521 - } 1522 - runtime.SetFinalizer(result, (*Sender).Destroy) 1523 - return result 1524 - } 1525 - 1526 - func (c FfiConverterSender) Read(reader io.Reader) *Sender { 1527 - return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1528 - } 1529 - 1530 - func (c FfiConverterSender) Lower(value *Sender) unsafe.Pointer { 1531 - // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1532 - // because the pointer will be decremented immediately after this function returns, 1533 - // and someone will be left holding onto a non-locked pointer. 1534 - pointer := value.ffiObject.incrementPointer("*Sender") 1535 - defer value.ffiObject.decrementPointer() 1536 - return pointer 1537 - 1538 - } 1539 - 1540 - func (c FfiConverterSender) Write(writer io.Writer, value *Sender) { 1541 - writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1542 - } 1543 - 1544 - type FfiDestroyerSender struct{} 1545 - 1546 - func (_ FfiDestroyerSender) Destroy(value *Sender) { 1547 - value.Destroy() 1548 - } 1549 - 1550 - // An Error. 1551 - type Error struct { 1552 - err error 1553 - } 1554 - 1555 - // Convience method to turn *Error into error 1556 - // Avoiding treating nil pointer as non nil error interface 1557 - func (err *Error) AsError() error { 1558 - if err == nil { 1559 - return nil 1560 - } else { 1561 - return err 1562 - } 1563 - } 1564 - 1565 - func (err Error) Error() string { 1566 - return fmt.Sprintf("Error: %s", err.err.Error()) 1567 - } 1568 - 1569 - func (err Error) Unwrap() error { 1570 - return err.err 1571 - } 1572 - 1573 - // Err* are used for checking error type with `errors.Is` 1574 - var ErrErrorIrohBind = fmt.Errorf("ErrorIrohBind") 1575 - var ErrErrorInvalidUrl = fmt.Errorf("ErrorInvalidUrl") 1576 - var ErrErrorIrohConnect = fmt.Errorf("ErrorIrohConnect") 1577 - var ErrErrorInvalidNetworkAddress = fmt.Errorf("ErrorInvalidNetworkAddress") 1578 - var ErrErrorOpenStream = fmt.Errorf("ErrorOpenStream") 1579 - var ErrErrorSendMessage = fmt.Errorf("ErrorSendMessage") 1580 - var ErrErrorNewConnection = fmt.Errorf("ErrorNewConnection") 1581 - var ErrErrorMissingConnection = fmt.Errorf("ErrorMissingConnection") 1582 - var ErrErrorInvalidPublicKey = fmt.Errorf("ErrorInvalidPublicKey") 1583 - 1584 - // Variant structs 1585 - type ErrorIrohBind struct { 1586 - message string 1587 - } 1588 - 1589 - func NewErrorIrohBind() *Error { 1590 - return &Error{err: &ErrorIrohBind{}} 1591 - } 1592 - 1593 - func (e ErrorIrohBind) destroy() { 1594 - } 1595 - 1596 - func (err ErrorIrohBind) Error() string { 1597 - return fmt.Sprintf("IrohBind: %s", err.message) 1598 - } 1599 - 1600 - func (self ErrorIrohBind) Is(target error) bool { 1601 - return target == ErrErrorIrohBind 1602 - } 1603 - 1604 - type ErrorInvalidUrl struct { 1605 - message string 1606 - } 1607 - 1608 - func NewErrorInvalidUrl() *Error { 1609 - return &Error{err: &ErrorInvalidUrl{}} 1610 - } 1611 - 1612 - func (e ErrorInvalidUrl) destroy() { 1613 - } 1614 - 1615 - func (err ErrorInvalidUrl) Error() string { 1616 - return fmt.Sprintf("InvalidUrl: %s", err.message) 1617 - } 1618 - 1619 - func (self ErrorInvalidUrl) Is(target error) bool { 1620 - return target == ErrErrorInvalidUrl 1621 - } 1622 - 1623 - type ErrorIrohConnect struct { 1624 - message string 1625 - } 1626 - 1627 - func NewErrorIrohConnect() *Error { 1628 - return &Error{err: &ErrorIrohConnect{}} 1629 - } 1630 - 1631 - func (e ErrorIrohConnect) destroy() { 1632 - } 1633 - 1634 - func (err ErrorIrohConnect) Error() string { 1635 - return fmt.Sprintf("IrohConnect: %s", err.message) 1636 - } 1637 - 1638 - func (self ErrorIrohConnect) Is(target error) bool { 1639 - return target == ErrErrorIrohConnect 1640 - } 1641 - 1642 - type ErrorInvalidNetworkAddress struct { 1643 - message string 1644 - } 1645 - 1646 - func NewErrorInvalidNetworkAddress() *Error { 1647 - return &Error{err: &ErrorInvalidNetworkAddress{}} 1648 - } 1649 - 1650 - func (e ErrorInvalidNetworkAddress) destroy() { 1651 - } 1652 - 1653 - func (err ErrorInvalidNetworkAddress) Error() string { 1654 - return fmt.Sprintf("InvalidNetworkAddress: %s", err.message) 1655 - } 1656 - 1657 - func (self ErrorInvalidNetworkAddress) Is(target error) bool { 1658 - return target == ErrErrorInvalidNetworkAddress 1659 - } 1660 - 1661 - type ErrorOpenStream struct { 1662 - message string 1663 - } 1664 - 1665 - func NewErrorOpenStream() *Error { 1666 - return &Error{err: &ErrorOpenStream{}} 1667 - } 1668 - 1669 - func (e ErrorOpenStream) destroy() { 1670 - } 1671 - 1672 - func (err ErrorOpenStream) Error() string { 1673 - return fmt.Sprintf("OpenStream: %s", err.message) 1674 - } 1675 - 1676 - func (self ErrorOpenStream) Is(target error) bool { 1677 - return target == ErrErrorOpenStream 1678 - } 1679 - 1680 - type ErrorSendMessage struct { 1681 - message string 1682 - } 1683 - 1684 - func NewErrorSendMessage() *Error { 1685 - return &Error{err: &ErrorSendMessage{}} 1686 - } 1687 - 1688 - func (e ErrorSendMessage) destroy() { 1689 - } 1690 - 1691 - func (err ErrorSendMessage) Error() string { 1692 - return fmt.Sprintf("SendMessage: %s", err.message) 1693 - } 1694 - 1695 - func (self ErrorSendMessage) Is(target error) bool { 1696 - return target == ErrErrorSendMessage 1697 - } 1698 - 1699 - type ErrorNewConnection struct { 1700 - message string 1701 - } 1702 - 1703 - func NewErrorNewConnection() *Error { 1704 - return &Error{err: &ErrorNewConnection{}} 1705 - } 1706 - 1707 - func (e ErrorNewConnection) destroy() { 1708 - } 1709 - 1710 - func (err ErrorNewConnection) Error() string { 1711 - return fmt.Sprintf("NewConnection: %s", err.message) 1712 - } 1713 - 1714 - func (self ErrorNewConnection) Is(target error) bool { 1715 - return target == ErrErrorNewConnection 1716 - } 1717 - 1718 - type ErrorMissingConnection struct { 1719 - message string 1720 - } 1721 - 1722 - func NewErrorMissingConnection() *Error { 1723 - return &Error{err: &ErrorMissingConnection{}} 1724 - } 1725 - 1726 - func (e ErrorMissingConnection) destroy() { 1727 - } 1728 - 1729 - func (err ErrorMissingConnection) Error() string { 1730 - return fmt.Sprintf("MissingConnection: %s", err.message) 1731 - } 1732 - 1733 - func (self ErrorMissingConnection) Is(target error) bool { 1734 - return target == ErrErrorMissingConnection 1735 - } 1736 - 1737 - type ErrorInvalidPublicKey struct { 1738 - message string 1739 - } 1740 - 1741 - func NewErrorInvalidPublicKey() *Error { 1742 - return &Error{err: &ErrorInvalidPublicKey{}} 1743 - } 1744 - 1745 - func (e ErrorInvalidPublicKey) destroy() { 1746 - } 1747 - 1748 - func (err ErrorInvalidPublicKey) Error() string { 1749 - return fmt.Sprintf("InvalidPublicKey: %s", err.message) 1750 - } 1751 - 1752 - func (self ErrorInvalidPublicKey) Is(target error) bool { 1753 - return target == ErrErrorInvalidPublicKey 1754 - } 1755 - 1756 - type FfiConverterError struct{} 1757 - 1758 - var FfiConverterErrorINSTANCE = FfiConverterError{} 1759 - 1760 - func (c FfiConverterError) Lift(eb RustBufferI) *Error { 1761 - return LiftFromRustBuffer[*Error](c, eb) 1762 - } 1763 - 1764 - func (c FfiConverterError) Lower(value *Error) C.RustBuffer { 1765 - return LowerIntoRustBuffer[*Error](c, value) 1766 - } 1767 - 1768 - func (c FfiConverterError) Read(reader io.Reader) *Error { 1769 - errorID := readUint32(reader) 1770 - 1771 - message := FfiConverterStringINSTANCE.Read(reader) 1772 - switch errorID { 1773 - case 1: 1774 - return &Error{&ErrorIrohBind{message}} 1775 - case 2: 1776 - return &Error{&ErrorInvalidUrl{message}} 1777 - case 3: 1778 - return &Error{&ErrorIrohConnect{message}} 1779 - case 4: 1780 - return &Error{&ErrorInvalidNetworkAddress{message}} 1781 - case 5: 1782 - return &Error{&ErrorOpenStream{message}} 1783 - case 6: 1784 - return &Error{&ErrorSendMessage{message}} 1785 - case 7: 1786 - return &Error{&ErrorNewConnection{message}} 1787 - case 8: 1788 - return &Error{&ErrorMissingConnection{message}} 1789 - case 9: 1790 - return &Error{&ErrorInvalidPublicKey{message}} 1791 - default: 1792 - panic(fmt.Sprintf("Unknown error code %d in FfiConverterError.Read()", errorID)) 1793 - } 1794 - 1795 - } 1796 - 1797 - func (c FfiConverterError) Write(writer io.Writer, value *Error) { 1798 - switch variantValue := value.err.(type) { 1799 - case *ErrorIrohBind: 1800 - writeInt32(writer, 1) 1801 - case *ErrorInvalidUrl: 1802 - writeInt32(writer, 2) 1803 - case *ErrorIrohConnect: 1804 - writeInt32(writer, 3) 1805 - case *ErrorInvalidNetworkAddress: 1806 - writeInt32(writer, 4) 1807 - case *ErrorOpenStream: 1808 - writeInt32(writer, 5) 1809 - case *ErrorSendMessage: 1810 - writeInt32(writer, 6) 1811 - case *ErrorNewConnection: 1812 - writeInt32(writer, 7) 1813 - case *ErrorMissingConnection: 1814 - writeInt32(writer, 8) 1815 - case *ErrorInvalidPublicKey: 1816 - writeInt32(writer, 9) 1817 - default: 1818 - _ = variantValue 1819 - panic(fmt.Sprintf("invalid error value `%v` in FfiConverterError.Write", value)) 1820 - } 1821 - } 1822 - 1823 - type FfiDestroyerError struct{} 1824 - 1825 - func (_ FfiDestroyerError) Destroy(value *Error) { 1826 - switch variantValue := value.err.(type) { 1827 - case ErrorIrohBind: 1828 - variantValue.destroy() 1829 - case ErrorInvalidUrl: 1830 - variantValue.destroy() 1831 - case ErrorIrohConnect: 1832 - variantValue.destroy() 1833 - case ErrorInvalidNetworkAddress: 1834 - variantValue.destroy() 1835 - case ErrorOpenStream: 1836 - variantValue.destroy() 1837 - case ErrorSendMessage: 1838 - variantValue.destroy() 1839 - case ErrorNewConnection: 1840 - variantValue.destroy() 1841 - case ErrorMissingConnection: 1842 - variantValue.destroy() 1843 - case ErrorInvalidPublicKey: 1844 - variantValue.destroy() 1845 - default: 1846 - _ = variantValue 1847 - panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerError.Destroy", value)) 1848 - } 1849 - } 1850 - 1851 - type FfiConverterOptionalString struct{} 1852 - 1853 - var FfiConverterOptionalStringINSTANCE = FfiConverterOptionalString{} 1854 - 1855 - func (c FfiConverterOptionalString) Lift(rb RustBufferI) *string { 1856 - return LiftFromRustBuffer[*string](c, rb) 1857 - } 1858 - 1859 - func (_ FfiConverterOptionalString) Read(reader io.Reader) *string { 1860 - if readInt8(reader) == 0 { 1861 - return nil 1862 - } 1863 - temp := FfiConverterStringINSTANCE.Read(reader) 1864 - return &temp 1865 - } 1866 - 1867 - func (c FfiConverterOptionalString) Lower(value *string) C.RustBuffer { 1868 - return LowerIntoRustBuffer[*string](c, value) 1869 - } 1870 - 1871 - func (_ FfiConverterOptionalString) Write(writer io.Writer, value *string) { 1872 - if value == nil { 1873 - writeInt8(writer, 0) 1874 - } else { 1875 - writeInt8(writer, 1) 1876 - FfiConverterStringINSTANCE.Write(writer, *value) 1877 - } 1878 - } 1879 - 1880 - type FfiDestroyerOptionalString struct{} 1881 - 1882 - func (_ FfiDestroyerOptionalString) Destroy(value *string) { 1883 - if value != nil { 1884 - FfiDestroyerString{}.Destroy(*value) 1885 - } 1886 - } 1887 - 1888 - type FfiConverterSequenceString struct{} 1889 - 1890 - var FfiConverterSequenceStringINSTANCE = FfiConverterSequenceString{} 1891 - 1892 - func (c FfiConverterSequenceString) Lift(rb RustBufferI) []string { 1893 - return LiftFromRustBuffer[[]string](c, rb) 1894 - } 1895 - 1896 - func (c FfiConverterSequenceString) Read(reader io.Reader) []string { 1897 - length := readInt32(reader) 1898 - if length == 0 { 1899 - return nil 1900 - } 1901 - result := make([]string, 0, length) 1902 - for i := int32(0); i < length; i++ { 1903 - result = append(result, FfiConverterStringINSTANCE.Read(reader)) 1904 - } 1905 - return result 1906 - } 1907 - 1908 - func (c FfiConverterSequenceString) Lower(value []string) C.RustBuffer { 1909 - return LowerIntoRustBuffer[[]string](c, value) 1910 - } 1911 - 1912 - func (c FfiConverterSequenceString) Write(writer io.Writer, value []string) { 1913 - if len(value) > math.MaxInt32 { 1914 - panic("[]string is too large to fit into Int32") 1915 - } 1916 - 1917 - writeInt32(writer, int32(len(value))) 1918 - for _, item := range value { 1919 - FfiConverterStringINSTANCE.Write(writer, item) 1920 - } 1921 - } 1922 - 1923 - type FfiDestroyerSequenceString struct{} 1924 - 1925 - func (FfiDestroyerSequenceString) Destroy(sequence []string) { 1926 - for _, value := range sequence { 1927 - FfiDestroyerString{}.Destroy(value) 1928 - } 1929 - } 1930 - 1931 - const ( 1932 - uniffiRustFuturePollReady int8 = 0 1933 - uniffiRustFuturePollMaybeReady int8 = 1 1934 - ) 1935 - 1936 - type rustFuturePollFunc func(C.uint64_t, C.UniffiRustFutureContinuationCallback, C.uint64_t) 1937 - type rustFutureCompleteFunc[T any] func(C.uint64_t, *C.RustCallStatus) T 1938 - type rustFutureFreeFunc func(C.uint64_t) 1939 - 1940 - //export iroh_streamplace_uniffiFutureContinuationCallback 1941 - func iroh_streamplace_uniffiFutureContinuationCallback(data C.uint64_t, pollResult C.int8_t) { 1942 - h := cgo.Handle(uintptr(data)) 1943 - waiter := h.Value().(chan int8) 1944 - waiter <- int8(pollResult) 1945 - } 1946 - 1947 - func uniffiRustCallAsync[E any, T any, F any]( 1948 - errConverter BufReader[*E], 1949 - completeFunc rustFutureCompleteFunc[F], 1950 - liftFunc func(F) T, 1951 - rustFuture C.uint64_t, 1952 - pollFunc rustFuturePollFunc, 1953 - freeFunc rustFutureFreeFunc, 1954 - ) (T, *E) { 1955 - defer freeFunc(rustFuture) 1956 - 1957 - pollResult := int8(-1) 1958 - waiter := make(chan int8, 1) 1959 - 1960 - chanHandle := cgo.NewHandle(waiter) 1961 - defer chanHandle.Delete() 1962 - 1963 - for pollResult != uniffiRustFuturePollReady { 1964 - pollFunc( 1965 - rustFuture, 1966 - (C.UniffiRustFutureContinuationCallback)(C.iroh_streamplace_uniffiFutureContinuationCallback), 1967 - C.uint64_t(chanHandle), 1968 - ) 1969 - pollResult = <-waiter 1970 - } 1971 - 1972 - var goValue T 1973 - var ffiValue F 1974 - var err *E 1975 - 1976 - ffiValue, err = rustCallWithError(errConverter, func(status *C.RustCallStatus) F { 1977 - return completeFunc(rustFuture, status) 1978 - }) 1979 - if err != nil { 1980 - return goValue, err 1981 - } 1982 - return liftFunc(ffiValue), nil 1983 - } 1984 - 1985 - //export iroh_streamplace_uniffiFreeGorutine 1986 - func iroh_streamplace_uniffiFreeGorutine(data C.uint64_t) { 1987 - handle := cgo.Handle(uintptr(data)) 1988 - defer handle.Delete() 1989 - 1990 - guard := handle.Value().(chan struct{}) 1991 - guard <- struct{}{} 1992 - }
-974
rust/iroh-streamplace/pkg/iroh_streamplace/generated/iroh_streamplace/iroh_streamplace.h
··· 1 - 2 - 3 - // This file was autogenerated by some hot garbage in the `uniffi` crate. 4 - // Trust me, you don't want to mess with it! 5 - 6 - 7 - 8 - #include <stdbool.h> 9 - #include <stdint.h> 10 - 11 - // The following structs are used to implement the lowest level 12 - // of the FFI, and thus useful to multiple uniffied crates. 13 - // We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H. 14 - #ifdef UNIFFI_SHARED_H 15 - // We also try to prevent mixing versions of shared uniffi header structs. 16 - // If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V6 17 - #ifndef UNIFFI_SHARED_HEADER_V6 18 - #error Combining helper code from multiple versions of uniffi is not supported 19 - #endif // ndef UNIFFI_SHARED_HEADER_V6 20 - #else 21 - #define UNIFFI_SHARED_H 22 - #define UNIFFI_SHARED_HEADER_V6 23 - // ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ 24 - // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ 25 - 26 - typedef struct RustBuffer { 27 - uint64_t capacity; 28 - uint64_t len; 29 - uint8_t *data; 30 - } RustBuffer; 31 - 32 - typedef struct ForeignBytes { 33 - int32_t len; 34 - const uint8_t *data; 35 - } ForeignBytes; 36 - 37 - // Error definitions 38 - typedef struct RustCallStatus { 39 - int8_t code; 40 - RustBuffer errorBuf; 41 - } RustCallStatus; 42 - 43 - #endif // UNIFFI_SHARED_H 44 - 45 - 46 - #ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK 47 - #define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK 48 - typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); 49 - 50 - // Making function static works arround: 51 - // https://github.com/golang/go/issues/11263 52 - static void call_UniffiRustFutureContinuationCallback( 53 - UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) 54 - { 55 - return cb(data, poll_result); 56 - } 57 - 58 - 59 - #endif 60 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE 61 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE 62 - typedef void (*UniffiForeignFutureFree)(uint64_t handle); 63 - 64 - // Making function static works arround: 65 - // https://github.com/golang/go/issues/11263 66 - static void call_UniffiForeignFutureFree( 67 - UniffiForeignFutureFree cb, uint64_t handle) 68 - { 69 - return cb(handle); 70 - } 71 - 72 - 73 - #endif 74 - #ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE 75 - #define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE 76 - typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); 77 - 78 - // Making function static works arround: 79 - // https://github.com/golang/go/issues/11263 80 - static void call_UniffiCallbackInterfaceFree( 81 - UniffiCallbackInterfaceFree cb, uint64_t handle) 82 - { 83 - return cb(handle); 84 - } 85 - 86 - 87 - #endif 88 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE 89 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE 90 - typedef struct UniffiForeignFuture { 91 - uint64_t handle; 92 - UniffiForeignFutureFree free; 93 - } UniffiForeignFuture; 94 - 95 - #endif 96 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 97 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 98 - typedef struct UniffiForeignFutureStructU8 { 99 - uint8_t returnValue; 100 - RustCallStatus callStatus; 101 - } UniffiForeignFutureStructU8; 102 - 103 - #endif 104 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 105 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 106 - typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); 107 - 108 - // Making function static works arround: 109 - // https://github.com/golang/go/issues/11263 110 - static void call_UniffiForeignFutureCompleteU8( 111 - UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) 112 - { 113 - return cb(callback_data, result); 114 - } 115 - 116 - 117 - #endif 118 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 119 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 120 - typedef struct UniffiForeignFutureStructI8 { 121 - int8_t returnValue; 122 - RustCallStatus callStatus; 123 - } UniffiForeignFutureStructI8; 124 - 125 - #endif 126 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 127 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 128 - typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); 129 - 130 - // Making function static works arround: 131 - // https://github.com/golang/go/issues/11263 132 - static void call_UniffiForeignFutureCompleteI8( 133 - UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) 134 - { 135 - return cb(callback_data, result); 136 - } 137 - 138 - 139 - #endif 140 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 141 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 142 - typedef struct UniffiForeignFutureStructU16 { 143 - uint16_t returnValue; 144 - RustCallStatus callStatus; 145 - } UniffiForeignFutureStructU16; 146 - 147 - #endif 148 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 149 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 150 - typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); 151 - 152 - // Making function static works arround: 153 - // https://github.com/golang/go/issues/11263 154 - static void call_UniffiForeignFutureCompleteU16( 155 - UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) 156 - { 157 - return cb(callback_data, result); 158 - } 159 - 160 - 161 - #endif 162 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 163 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 164 - typedef struct UniffiForeignFutureStructI16 { 165 - int16_t returnValue; 166 - RustCallStatus callStatus; 167 - } UniffiForeignFutureStructI16; 168 - 169 - #endif 170 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 171 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 172 - typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); 173 - 174 - // Making function static works arround: 175 - // https://github.com/golang/go/issues/11263 176 - static void call_UniffiForeignFutureCompleteI16( 177 - UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) 178 - { 179 - return cb(callback_data, result); 180 - } 181 - 182 - 183 - #endif 184 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 185 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 186 - typedef struct UniffiForeignFutureStructU32 { 187 - uint32_t returnValue; 188 - RustCallStatus callStatus; 189 - } UniffiForeignFutureStructU32; 190 - 191 - #endif 192 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 193 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 194 - typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); 195 - 196 - // Making function static works arround: 197 - // https://github.com/golang/go/issues/11263 198 - static void call_UniffiForeignFutureCompleteU32( 199 - UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) 200 - { 201 - return cb(callback_data, result); 202 - } 203 - 204 - 205 - #endif 206 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 207 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 208 - typedef struct UniffiForeignFutureStructI32 { 209 - int32_t returnValue; 210 - RustCallStatus callStatus; 211 - } UniffiForeignFutureStructI32; 212 - 213 - #endif 214 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 215 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 216 - typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); 217 - 218 - // Making function static works arround: 219 - // https://github.com/golang/go/issues/11263 220 - static void call_UniffiForeignFutureCompleteI32( 221 - UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) 222 - { 223 - return cb(callback_data, result); 224 - } 225 - 226 - 227 - #endif 228 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 229 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 230 - typedef struct UniffiForeignFutureStructU64 { 231 - uint64_t returnValue; 232 - RustCallStatus callStatus; 233 - } UniffiForeignFutureStructU64; 234 - 235 - #endif 236 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 237 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 238 - typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); 239 - 240 - // Making function static works arround: 241 - // https://github.com/golang/go/issues/11263 242 - static void call_UniffiForeignFutureCompleteU64( 243 - UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) 244 - { 245 - return cb(callback_data, result); 246 - } 247 - 248 - 249 - #endif 250 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 251 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 252 - typedef struct UniffiForeignFutureStructI64 { 253 - int64_t returnValue; 254 - RustCallStatus callStatus; 255 - } UniffiForeignFutureStructI64; 256 - 257 - #endif 258 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 259 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 260 - typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); 261 - 262 - // Making function static works arround: 263 - // https://github.com/golang/go/issues/11263 264 - static void call_UniffiForeignFutureCompleteI64( 265 - UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) 266 - { 267 - return cb(callback_data, result); 268 - } 269 - 270 - 271 - #endif 272 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 273 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 274 - typedef struct UniffiForeignFutureStructF32 { 275 - float returnValue; 276 - RustCallStatus callStatus; 277 - } UniffiForeignFutureStructF32; 278 - 279 - #endif 280 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 281 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 282 - typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); 283 - 284 - // Making function static works arround: 285 - // https://github.com/golang/go/issues/11263 286 - static void call_UniffiForeignFutureCompleteF32( 287 - UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) 288 - { 289 - return cb(callback_data, result); 290 - } 291 - 292 - 293 - #endif 294 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 295 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 296 - typedef struct UniffiForeignFutureStructF64 { 297 - double returnValue; 298 - RustCallStatus callStatus; 299 - } UniffiForeignFutureStructF64; 300 - 301 - #endif 302 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 303 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 304 - typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); 305 - 306 - // Making function static works arround: 307 - // https://github.com/golang/go/issues/11263 308 - static void call_UniffiForeignFutureCompleteF64( 309 - UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) 310 - { 311 - return cb(callback_data, result); 312 - } 313 - 314 - 315 - #endif 316 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER 317 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER 318 - typedef struct UniffiForeignFutureStructPointer { 319 - void* returnValue; 320 - RustCallStatus callStatus; 321 - } UniffiForeignFutureStructPointer; 322 - 323 - #endif 324 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER 325 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER 326 - typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); 327 - 328 - // Making function static works arround: 329 - // https://github.com/golang/go/issues/11263 330 - static void call_UniffiForeignFutureCompletePointer( 331 - UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) 332 - { 333 - return cb(callback_data, result); 334 - } 335 - 336 - 337 - #endif 338 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER 339 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER 340 - typedef struct UniffiForeignFutureStructRustBuffer { 341 - RustBuffer returnValue; 342 - RustCallStatus callStatus; 343 - } UniffiForeignFutureStructRustBuffer; 344 - 345 - #endif 346 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER 347 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER 348 - typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); 349 - 350 - // Making function static works arround: 351 - // https://github.com/golang/go/issues/11263 352 - static void call_UniffiForeignFutureCompleteRustBuffer( 353 - UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) 354 - { 355 - return cb(callback_data, result); 356 - } 357 - 358 - 359 - #endif 360 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID 361 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID 362 - typedef struct UniffiForeignFutureStructVoid { 363 - RustCallStatus callStatus; 364 - } UniffiForeignFutureStructVoid; 365 - 366 - #endif 367 - #ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID 368 - #define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID 369 - typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); 370 - 371 - // Making function static works arround: 372 - // https://github.com/golang/go/issues/11263 373 - static void call_UniffiForeignFutureCompleteVoid( 374 - UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) 375 - { 376 - return cb(callback_data, result); 377 - } 378 - 379 - 380 - #endif 381 - #ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_METHOD0 382 - #define UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_METHOD0 383 - typedef void (*UniffiCallbackInterfaceDataHandlerMethod0)(uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return); 384 - 385 - // Making function static works arround: 386 - // https://github.com/golang/go/issues/11263 387 - static void call_UniffiCallbackInterfaceDataHandlerMethod0( 388 - UniffiCallbackInterfaceDataHandlerMethod0 cb, uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return) 389 - { 390 - return cb(uniffi_handle, peer, data, uniffi_future_callback, uniffi_callback_data, uniffi_out_return); 391 - } 392 - 393 - 394 - #endif 395 - #ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_DATA_HANDLER 396 - #define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_DATA_HANDLER 397 - typedef struct UniffiVTableCallbackInterfaceDataHandler { 398 - UniffiCallbackInterfaceDataHandlerMethod0 handleData; 399 - UniffiCallbackInterfaceFree uniffiFree; 400 - } UniffiVTableCallbackInterfaceDataHandler; 401 - 402 - #endif 403 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DATAHANDLER 404 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DATAHANDLER 405 - void* uniffi_iroh_streamplace_fn_clone_datahandler(void* ptr, RustCallStatus *out_status 406 - ); 407 - #endif 408 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DATAHANDLER 409 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DATAHANDLER 410 - void uniffi_iroh_streamplace_fn_free_datahandler(void* ptr, RustCallStatus *out_status 411 - ); 412 - #endif 413 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_INIT_CALLBACK_VTABLE_DATAHANDLER 414 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_INIT_CALLBACK_VTABLE_DATAHANDLER 415 - void uniffi_iroh_streamplace_fn_init_callback_vtable_datahandler(UniffiVTableCallbackInterfaceDataHandler* vtable 416 - ); 417 - #endif 418 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLER_HANDLE_DATA 419 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLER_HANDLE_DATA 420 - uint64_t uniffi_iroh_streamplace_fn_method_datahandler_handle_data(void* ptr, void* peer, RustBuffer data 421 - ); 422 - #endif 423 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_ENDPOINT 424 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_ENDPOINT 425 - void* uniffi_iroh_streamplace_fn_clone_endpoint(void* ptr, RustCallStatus *out_status 426 - ); 427 - #endif 428 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_ENDPOINT 429 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_ENDPOINT 430 - void uniffi_iroh_streamplace_fn_free_endpoint(void* ptr, RustCallStatus *out_status 431 - ); 432 - #endif 433 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_ENDPOINT_NEW 434 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_ENDPOINT_NEW 435 - uint64_t uniffi_iroh_streamplace_fn_constructor_endpoint_new(void 436 - 437 - ); 438 - #endif 439 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_ENDPOINT_NODE_ADDR 440 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_ENDPOINT_NODE_ADDR 441 - uint64_t uniffi_iroh_streamplace_fn_method_endpoint_node_addr(void* ptr 442 - ); 443 - #endif 444 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODEADDR 445 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODEADDR 446 - void* uniffi_iroh_streamplace_fn_clone_nodeaddr(void* ptr, RustCallStatus *out_status 447 - ); 448 - #endif 449 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_NODEADDR 450 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_NODEADDR 451 - void uniffi_iroh_streamplace_fn_free_nodeaddr(void* ptr, RustCallStatus *out_status 452 - ); 453 - #endif 454 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODEADDR_NEW 455 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODEADDR_NEW 456 - void* uniffi_iroh_streamplace_fn_constructor_nodeaddr_new(void* node_id, RustBuffer derp_url, RustBuffer addresses, RustCallStatus *out_status 457 - ); 458 - #endif 459 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_DIRECT_ADDRESSES 460 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_DIRECT_ADDRESSES 461 - RustBuffer uniffi_iroh_streamplace_fn_method_nodeaddr_direct_addresses(void* ptr, RustCallStatus *out_status 462 - ); 463 - #endif 464 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_EQUAL 465 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_EQUAL 466 - int8_t uniffi_iroh_streamplace_fn_method_nodeaddr_equal(void* ptr, void* other, RustCallStatus *out_status 467 - ); 468 - #endif 469 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_NODE_ID 470 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_NODE_ID 471 - void* uniffi_iroh_streamplace_fn_method_nodeaddr_node_id(void* ptr, RustCallStatus *out_status 472 - ); 473 - #endif 474 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_RELAY_URL 475 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODEADDR_RELAY_URL 476 - RustBuffer uniffi_iroh_streamplace_fn_method_nodeaddr_relay_url(void* ptr, RustCallStatus *out_status 477 - ); 478 - #endif 479 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_PUBLICKEY 480 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_PUBLICKEY 481 - void* uniffi_iroh_streamplace_fn_clone_publickey(void* ptr, RustCallStatus *out_status 482 - ); 483 - #endif 484 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_PUBLICKEY 485 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_PUBLICKEY 486 - void uniffi_iroh_streamplace_fn_free_publickey(void* ptr, RustCallStatus *out_status 487 - ); 488 - #endif 489 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEY_FROM_BYTES 490 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEY_FROM_BYTES 491 - void* uniffi_iroh_streamplace_fn_constructor_publickey_from_bytes(RustBuffer bytes, RustCallStatus *out_status 492 - ); 493 - #endif 494 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEY_FROM_STRING 495 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEY_FROM_STRING 496 - void* uniffi_iroh_streamplace_fn_constructor_publickey_from_string(RustBuffer s, RustCallStatus *out_status 497 - ); 498 - #endif 499 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_EQUAL 500 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_EQUAL 501 - int8_t uniffi_iroh_streamplace_fn_method_publickey_equal(void* ptr, void* other, RustCallStatus *out_status 502 - ); 503 - #endif 504 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_FMT_SHORT 505 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_FMT_SHORT 506 - RustBuffer uniffi_iroh_streamplace_fn_method_publickey_fmt_short(void* ptr, RustCallStatus *out_status 507 - ); 508 - #endif 509 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_TO_BYTES 510 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_TO_BYTES 511 - RustBuffer uniffi_iroh_streamplace_fn_method_publickey_to_bytes(void* ptr, RustCallStatus *out_status 512 - ); 513 - #endif 514 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_UNIFFI_TRAIT_DISPLAY 515 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_UNIFFI_TRAIT_DISPLAY 516 - RustBuffer uniffi_iroh_streamplace_fn_method_publickey_uniffi_trait_display(void* ptr, RustCallStatus *out_status 517 - ); 518 - #endif 519 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_RECEIVER 520 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_RECEIVER 521 - void* uniffi_iroh_streamplace_fn_clone_receiver(void* ptr, RustCallStatus *out_status 522 - ); 523 - #endif 524 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_RECEIVER 525 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_RECEIVER 526 - void uniffi_iroh_streamplace_fn_free_receiver(void* ptr, RustCallStatus *out_status 527 - ); 528 - #endif 529 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_RECEIVER_NEW 530 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_RECEIVER_NEW 531 - uint64_t uniffi_iroh_streamplace_fn_constructor_receiver_new(void* endpoint, void* handler 532 - ); 533 - #endif 534 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_NODE_ADDR 535 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_NODE_ADDR 536 - uint64_t uniffi_iroh_streamplace_fn_method_receiver_node_addr(void* ptr 537 - ); 538 - #endif 539 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SENDER 540 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SENDER 541 - void* uniffi_iroh_streamplace_fn_clone_sender(void* ptr, RustCallStatus *out_status 542 - ); 543 - #endif 544 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_SENDER 545 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_SENDER 546 - void uniffi_iroh_streamplace_fn_free_sender(void* ptr, RustCallStatus *out_status 547 - ); 548 - #endif 549 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_SENDER_NEW 550 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_SENDER_NEW 551 - uint64_t uniffi_iroh_streamplace_fn_constructor_sender_new(void* endpoint 552 - ); 553 - #endif 554 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_ADD_PEER 555 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_ADD_PEER 556 - uint64_t uniffi_iroh_streamplace_fn_method_sender_add_peer(void* ptr, void* addr 557 - ); 558 - #endif 559 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_NODE_ADDR 560 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_NODE_ADDR 561 - uint64_t uniffi_iroh_streamplace_fn_method_sender_node_addr(void* ptr 562 - ); 563 - #endif 564 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_SEND 565 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_SEND 566 - uint64_t uniffi_iroh_streamplace_fn_method_sender_send(void* ptr, void* node_id, RustBuffer data 567 - ); 568 - #endif 569 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_ALLOC 570 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_ALLOC 571 - RustBuffer ffi_iroh_streamplace_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status 572 - ); 573 - #endif 574 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_FROM_BYTES 575 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_FROM_BYTES 576 - RustBuffer ffi_iroh_streamplace_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status 577 - ); 578 - #endif 579 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_FREE 580 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_FREE 581 - void ffi_iroh_streamplace_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status 582 - ); 583 - #endif 584 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_RESERVE 585 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_RESERVE 586 - RustBuffer ffi_iroh_streamplace_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status 587 - ); 588 - #endif 589 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U8 590 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U8 591 - void ffi_iroh_streamplace_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 592 - ); 593 - #endif 594 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U8 595 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U8 596 - void ffi_iroh_streamplace_rust_future_cancel_u8(uint64_t handle 597 - ); 598 - #endif 599 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U8 600 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U8 601 - void ffi_iroh_streamplace_rust_future_free_u8(uint64_t handle 602 - ); 603 - #endif 604 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U8 605 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U8 606 - uint8_t ffi_iroh_streamplace_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status 607 - ); 608 - #endif 609 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I8 610 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I8 611 - void ffi_iroh_streamplace_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 612 - ); 613 - #endif 614 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I8 615 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I8 616 - void ffi_iroh_streamplace_rust_future_cancel_i8(uint64_t handle 617 - ); 618 - #endif 619 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I8 620 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I8 621 - void ffi_iroh_streamplace_rust_future_free_i8(uint64_t handle 622 - ); 623 - #endif 624 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I8 625 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I8 626 - int8_t ffi_iroh_streamplace_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status 627 - ); 628 - #endif 629 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U16 630 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U16 631 - void ffi_iroh_streamplace_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 632 - ); 633 - #endif 634 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U16 635 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U16 636 - void ffi_iroh_streamplace_rust_future_cancel_u16(uint64_t handle 637 - ); 638 - #endif 639 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U16 640 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U16 641 - void ffi_iroh_streamplace_rust_future_free_u16(uint64_t handle 642 - ); 643 - #endif 644 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U16 645 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U16 646 - uint16_t ffi_iroh_streamplace_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status 647 - ); 648 - #endif 649 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I16 650 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I16 651 - void ffi_iroh_streamplace_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 652 - ); 653 - #endif 654 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I16 655 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I16 656 - void ffi_iroh_streamplace_rust_future_cancel_i16(uint64_t handle 657 - ); 658 - #endif 659 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I16 660 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I16 661 - void ffi_iroh_streamplace_rust_future_free_i16(uint64_t handle 662 - ); 663 - #endif 664 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I16 665 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I16 666 - int16_t ffi_iroh_streamplace_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status 667 - ); 668 - #endif 669 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U32 670 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U32 671 - void ffi_iroh_streamplace_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 672 - ); 673 - #endif 674 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U32 675 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U32 676 - void ffi_iroh_streamplace_rust_future_cancel_u32(uint64_t handle 677 - ); 678 - #endif 679 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U32 680 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U32 681 - void ffi_iroh_streamplace_rust_future_free_u32(uint64_t handle 682 - ); 683 - #endif 684 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U32 685 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U32 686 - uint32_t ffi_iroh_streamplace_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status 687 - ); 688 - #endif 689 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I32 690 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I32 691 - void ffi_iroh_streamplace_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 692 - ); 693 - #endif 694 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I32 695 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I32 696 - void ffi_iroh_streamplace_rust_future_cancel_i32(uint64_t handle 697 - ); 698 - #endif 699 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I32 700 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I32 701 - void ffi_iroh_streamplace_rust_future_free_i32(uint64_t handle 702 - ); 703 - #endif 704 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I32 705 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I32 706 - int32_t ffi_iroh_streamplace_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status 707 - ); 708 - #endif 709 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U64 710 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_U64 711 - void ffi_iroh_streamplace_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 712 - ); 713 - #endif 714 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U64 715 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_U64 716 - void ffi_iroh_streamplace_rust_future_cancel_u64(uint64_t handle 717 - ); 718 - #endif 719 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U64 720 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_U64 721 - void ffi_iroh_streamplace_rust_future_free_u64(uint64_t handle 722 - ); 723 - #endif 724 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U64 725 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_U64 726 - uint64_t ffi_iroh_streamplace_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status 727 - ); 728 - #endif 729 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I64 730 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_I64 731 - void ffi_iroh_streamplace_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 732 - ); 733 - #endif 734 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I64 735 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_I64 736 - void ffi_iroh_streamplace_rust_future_cancel_i64(uint64_t handle 737 - ); 738 - #endif 739 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I64 740 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_I64 741 - void ffi_iroh_streamplace_rust_future_free_i64(uint64_t handle 742 - ); 743 - #endif 744 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I64 745 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_I64 746 - int64_t ffi_iroh_streamplace_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status 747 - ); 748 - #endif 749 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_F32 750 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_F32 751 - void ffi_iroh_streamplace_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 752 - ); 753 - #endif 754 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_F32 755 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_F32 756 - void ffi_iroh_streamplace_rust_future_cancel_f32(uint64_t handle 757 - ); 758 - #endif 759 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_F32 760 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_F32 761 - void ffi_iroh_streamplace_rust_future_free_f32(uint64_t handle 762 - ); 763 - #endif 764 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_F32 765 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_F32 766 - float ffi_iroh_streamplace_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status 767 - ); 768 - #endif 769 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_F64 770 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_F64 771 - void ffi_iroh_streamplace_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 772 - ); 773 - #endif 774 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_F64 775 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_F64 776 - void ffi_iroh_streamplace_rust_future_cancel_f64(uint64_t handle 777 - ); 778 - #endif 779 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_F64 780 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_F64 781 - void ffi_iroh_streamplace_rust_future_free_f64(uint64_t handle 782 - ); 783 - #endif 784 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_F64 785 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_F64 786 - double ffi_iroh_streamplace_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status 787 - ); 788 - #endif 789 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_POINTER 790 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_POINTER 791 - void ffi_iroh_streamplace_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 792 - ); 793 - #endif 794 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_POINTER 795 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_POINTER 796 - void ffi_iroh_streamplace_rust_future_cancel_pointer(uint64_t handle 797 - ); 798 - #endif 799 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_POINTER 800 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_POINTER 801 - void ffi_iroh_streamplace_rust_future_free_pointer(uint64_t handle 802 - ); 803 - #endif 804 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_POINTER 805 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_POINTER 806 - void* ffi_iroh_streamplace_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status 807 - ); 808 - #endif 809 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_RUST_BUFFER 810 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_RUST_BUFFER 811 - void ffi_iroh_streamplace_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 812 - ); 813 - #endif 814 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_RUST_BUFFER 815 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_RUST_BUFFER 816 - void ffi_iroh_streamplace_rust_future_cancel_rust_buffer(uint64_t handle 817 - ); 818 - #endif 819 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_RUST_BUFFER 820 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_RUST_BUFFER 821 - void ffi_iroh_streamplace_rust_future_free_rust_buffer(uint64_t handle 822 - ); 823 - #endif 824 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_RUST_BUFFER 825 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_RUST_BUFFER 826 - RustBuffer ffi_iroh_streamplace_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status 827 - ); 828 - #endif 829 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_VOID 830 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_POLL_VOID 831 - void ffi_iroh_streamplace_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data 832 - ); 833 - #endif 834 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_VOID 835 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_CANCEL_VOID 836 - void ffi_iroh_streamplace_rust_future_cancel_void(uint64_t handle 837 - ); 838 - #endif 839 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_VOID 840 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_FREE_VOID 841 - void ffi_iroh_streamplace_rust_future_free_void(uint64_t handle 842 - ); 843 - #endif 844 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_VOID 845 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUST_FUTURE_COMPLETE_VOID 846 - void ffi_iroh_streamplace_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status 847 - ); 848 - #endif 849 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLER_HANDLE_DATA 850 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLER_HANDLE_DATA 851 - uint16_t uniffi_iroh_streamplace_checksum_method_datahandler_handle_data(void 852 - 853 - ); 854 - #endif 855 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_ENDPOINT_NODE_ADDR 856 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_ENDPOINT_NODE_ADDR 857 - uint16_t uniffi_iroh_streamplace_checksum_method_endpoint_node_addr(void 858 - 859 - ); 860 - #endif 861 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_DIRECT_ADDRESSES 862 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_DIRECT_ADDRESSES 863 - uint16_t uniffi_iroh_streamplace_checksum_method_nodeaddr_direct_addresses(void 864 - 865 - ); 866 - #endif 867 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_EQUAL 868 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_EQUAL 869 - uint16_t uniffi_iroh_streamplace_checksum_method_nodeaddr_equal(void 870 - 871 - ); 872 - #endif 873 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_NODE_ID 874 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_NODE_ID 875 - uint16_t uniffi_iroh_streamplace_checksum_method_nodeaddr_node_id(void 876 - 877 - ); 878 - #endif 879 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_RELAY_URL 880 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_RELAY_URL 881 - uint16_t uniffi_iroh_streamplace_checksum_method_nodeaddr_relay_url(void 882 - 883 - ); 884 - #endif 885 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_EQUAL 886 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_EQUAL 887 - uint16_t uniffi_iroh_streamplace_checksum_method_publickey_equal(void 888 - 889 - ); 890 - #endif 891 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_FMT_SHORT 892 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_FMT_SHORT 893 - uint16_t uniffi_iroh_streamplace_checksum_method_publickey_fmt_short(void 894 - 895 - ); 896 - #endif 897 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_TO_BYTES 898 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_TO_BYTES 899 - uint16_t uniffi_iroh_streamplace_checksum_method_publickey_to_bytes(void 900 - 901 - ); 902 - #endif 903 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_NODE_ADDR 904 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_NODE_ADDR 905 - uint16_t uniffi_iroh_streamplace_checksum_method_receiver_node_addr(void 906 - 907 - ); 908 - #endif 909 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_ADD_PEER 910 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_ADD_PEER 911 - uint16_t uniffi_iroh_streamplace_checksum_method_sender_add_peer(void 912 - 913 - ); 914 - #endif 915 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_NODE_ADDR 916 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_NODE_ADDR 917 - uint16_t uniffi_iroh_streamplace_checksum_method_sender_node_addr(void 918 - 919 - ); 920 - #endif 921 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_SEND 922 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_SEND 923 - uint16_t uniffi_iroh_streamplace_checksum_method_sender_send(void 924 - 925 - ); 926 - #endif 927 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_ENDPOINT_NEW 928 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_ENDPOINT_NEW 929 - uint16_t uniffi_iroh_streamplace_checksum_constructor_endpoint_new(void 930 - 931 - ); 932 - #endif 933 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODEADDR_NEW 934 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODEADDR_NEW 935 - uint16_t uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new(void 936 - 937 - ); 938 - #endif 939 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEY_FROM_BYTES 940 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEY_FROM_BYTES 941 - uint16_t uniffi_iroh_streamplace_checksum_constructor_publickey_from_bytes(void 942 - 943 - ); 944 - #endif 945 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEY_FROM_STRING 946 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEY_FROM_STRING 947 - uint16_t uniffi_iroh_streamplace_checksum_constructor_publickey_from_string(void 948 - 949 - ); 950 - #endif 951 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_RECEIVER_NEW 952 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_RECEIVER_NEW 953 - uint16_t uniffi_iroh_streamplace_checksum_constructor_receiver_new(void 954 - 955 - ); 956 - #endif 957 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_SENDER_NEW 958 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_SENDER_NEW 959 - uint16_t uniffi_iroh_streamplace_checksum_constructor_sender_new(void 960 - 961 - ); 962 - #endif 963 - #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_UNIFFI_CONTRACT_VERSION 964 - #define UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_UNIFFI_CONTRACT_VERSION 965 - uint32_t ffi_iroh_streamplace_uniffi_contract_version(void 966 - 967 - ); 968 - #endif 969 - 970 - void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return); 971 - void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree(uint64_t handle); 972 - 973 - void iroh_streamplace_uniffiFutureContinuationCallback(uint64_t, int8_t); 974 - void iroh_streamplace_uniffiFreeGorutine(uint64_t);