1 use { 2 crate::{ 3 AsContextMut, ValRaw, 4 component::{HasData, HasSelf, Instance}, 5 store::StoreInner, 6 vm::{VMFuncRef, VMMemoryDefinition, VMStore, component::ComponentInstance}, 7 }, 8 anyhow::Result, 9 futures::{FutureExt, stream::FuturesUnordered}, 10 std::{boxed::Box, future::Future, mem::MaybeUninit, pin::Pin}, 11 wasmtime_environ::component::{ 12 RuntimeComponentInstanceIndex, TypeComponentLocalErrorContextTableIndex, 13 TypeFutureTableIndex, TypeStreamTableIndex, TypeTupleIndex, 14 }, 15 }; 16 17 pub(crate) use futures_and_streams::ResourcePair; 18 pub use futures_and_streams::{ErrorContext, FutureReader, StreamReader}; 19 20 mod futures_and_streams; 21 22 /// Represents the result of a concurrent operation. 23 /// 24 /// This is similar to a [`std::future::Future`] except that it represents an 25 /// operation which requires exclusive access to a store in order to make 26 /// progress -- without monopolizing that store for the lifetime of the 27 /// operation. 28 pub struct Promise<T>(Pin<Box<dyn Future<Output = T> + Send + Sync + 'static>>); 29 30 impl<T: 'static> Promise<T> { 31 /// Map the result of this `Promise` from one value to another. 32 pub fn map<U>(self, fun: impl FnOnce(T) -> U + Send + Sync + 'static) -> Promise<U> { 33 Promise(Box::pin(self.0.map(fun))) 34 } 35 36 /// Convert this `Promise` to a future which may be `await`ed for its 37 /// result. 38 /// 39 /// The returned future will require exclusive use of the store until it 40 /// completes. If you need to await more than one `Promise` concurrently, 41 /// use [`PromisesUnordered`]. 42 pub async fn get<U: Send>(self, store: impl AsContextMut<Data = U>) -> Result<T> { 43 _ = store; 44 todo!() 45 } 46 47 /// Convert this `Promise` to a future which may be `await`ed for its 48 /// result. 49 /// 50 /// Unlike [`Self::get`], this does _not_ take a store parameter, meaning 51 /// the returned future will not make progress until and unless the event 52 /// loop for the store it came from is polled. Thus, this method should 53 /// only be used from within host functions and not from top-level embedder 54 /// code. 55 pub fn into_future(self) -> Pin<Box<dyn Future<Output = T> + Send + Sync + 'static>> { 56 self.0 57 } 58 } 59 60 /// Represents a collection of zero or more concurrent operations. 61 /// 62 /// Similar to [`futures::stream::FuturesUnordered`], this type supports 63 /// `await`ing more than one [`Promise`]s concurrently. 64 pub struct PromisesUnordered<T>( 65 FuturesUnordered<Pin<Box<dyn Future<Output = T> + Send + Sync + 'static>>>, 66 ); 67 68 impl<T: 'static> PromisesUnordered<T> { 69 /// Create a new `PromisesUnordered` with no entries. 70 pub fn new() -> Self { 71 Self(FuturesUnordered::new()) 72 } 73 74 /// Add the specified [`Promise`] to this collection. 75 pub fn push(&mut self, promise: Promise<T>) { 76 self.0.push(promise.0) 77 } 78 79 /// Get the next result from this collection, if any. 80 pub async fn next<U: Send>(&mut self, store: impl AsContextMut<Data = U>) -> Result<Option<T>> { 81 _ = store; 82 todo!() 83 } 84 } 85 86 /// Provides scoped mutable access to store data in the context of a concurrent 87 /// host task future. 88 /// 89 /// This allows multiple host task futures to execute concurrently and access 90 /// the store between (but not across) `await` points. 91 pub struct Accessor<T: 'static, D = HasSelf<T>> 92 where 93 D: HasData, 94 { 95 #[expect(dead_code, reason = "to be used in the future")] 96 get: fn() -> *mut dyn VMStore, 97 #[expect(dead_code, reason = "to be used in the future")] 98 get_data: fn(&mut T) -> D::Data<'_>, 99 #[expect(dead_code, reason = "to be used in the future")] 100 instance: Instance, 101 } 102 103 impl<T, D> Accessor<T, D> 104 where 105 D: HasData, 106 { 107 #[doc(hidden)] 108 pub fn with_data<D2: HasData>( 109 &mut self, 110 get_data: fn(&mut T) -> D2::Data<'_>, 111 ) -> Accessor<T, D2> { 112 let _ = get_data; 113 todo!() 114 } 115 } 116 117 /// Trait representing component model ABI async intrinsics and fused adapter 118 /// helper functions. 119 pub unsafe trait VMComponentAsyncStore { 120 /// The `backpressure.set` intrinsic. 121 fn backpressure_set( 122 &mut self, 123 caller_instance: RuntimeComponentInstanceIndex, 124 enabled: u32, 125 ) -> Result<()>; 126 127 /// The `task.return` intrinsic. 128 fn task_return( 129 &mut self, 130 instance: &mut ComponentInstance, 131 ty: TypeTupleIndex, 132 storage: *mut ValRaw, 133 storage_len: usize, 134 ) -> Result<()>; 135 136 /// The `waitable-set.new` intrinsic. 137 fn waitable_set_new( 138 &mut self, 139 instance: &mut ComponentInstance, 140 caller_instance: RuntimeComponentInstanceIndex, 141 ) -> Result<u32>; 142 143 /// The `waitable-set.wait` intrinsic. 144 fn waitable_set_wait( 145 &mut self, 146 instance: &mut ComponentInstance, 147 caller_instance: RuntimeComponentInstanceIndex, 148 set: u32, 149 async_: bool, 150 memory: *mut VMMemoryDefinition, 151 payload: u32, 152 ) -> Result<u32>; 153 154 /// The `waitable-set.poll` intrinsic. 155 fn waitable_set_poll( 156 &mut self, 157 instance: &mut ComponentInstance, 158 caller_instance: RuntimeComponentInstanceIndex, 159 set: u32, 160 async_: bool, 161 memory: *mut VMMemoryDefinition, 162 payload: u32, 163 ) -> Result<u32>; 164 165 /// The `waitable-set.drop` intrinsic. 166 fn waitable_set_drop( 167 &mut self, 168 instance: &mut ComponentInstance, 169 caller_instance: RuntimeComponentInstanceIndex, 170 set: u32, 171 ) -> Result<()>; 172 173 /// The `waitable.join` intrinsic. 174 fn waitable_join( 175 &mut self, 176 instance: &mut ComponentInstance, 177 caller_instance: RuntimeComponentInstanceIndex, 178 set: u32, 179 waitable: u32, 180 ) -> Result<()>; 181 182 /// The `yield` intrinsic. 183 fn yield_(&mut self, instance: &mut ComponentInstance, async_: bool) -> Result<()>; 184 185 /// The `subtask.drop` intrinsic. 186 fn subtask_drop( 187 &mut self, 188 instance: &mut ComponentInstance, 189 caller_instance: RuntimeComponentInstanceIndex, 190 task_id: u32, 191 ) -> Result<()>; 192 193 /// A helper function for fused adapter modules involving calls where the 194 /// caller is sync-lowered but the callee is async-lifted. 195 fn sync_enter( 196 &mut self, 197 start: *mut VMFuncRef, 198 return_: *mut VMFuncRef, 199 caller_instance: RuntimeComponentInstanceIndex, 200 task_return_type: TypeTupleIndex, 201 result_count: u32, 202 storage: *mut ValRaw, 203 storage_len: usize, 204 ) -> Result<()>; 205 206 /// A helper function for fused adapter modules involving calls where the 207 /// caller is sync-lowered but the callee is async-lifted. 208 fn sync_exit( 209 &mut self, 210 instance: &mut ComponentInstance, 211 callback: *mut VMFuncRef, 212 caller_instance: RuntimeComponentInstanceIndex, 213 callee: *mut VMFuncRef, 214 callee_instance: RuntimeComponentInstanceIndex, 215 param_count: u32, 216 storage: *mut MaybeUninit<ValRaw>, 217 storage_len: usize, 218 ) -> Result<()>; 219 220 /// A helper function for fused adapter modules involving calls where the 221 /// caller is async-lowered. 222 fn async_enter( 223 &mut self, 224 start: *mut VMFuncRef, 225 return_: *mut VMFuncRef, 226 caller_instance: RuntimeComponentInstanceIndex, 227 task_return_type: TypeTupleIndex, 228 params: u32, 229 results: u32, 230 ) -> Result<()>; 231 232 /// A helper function for fused adapter modules involving calls where the 233 /// caller is async-lowered. 234 fn async_exit( 235 &mut self, 236 instance: &mut ComponentInstance, 237 callback: *mut VMFuncRef, 238 post_return: *mut VMFuncRef, 239 caller_instance: RuntimeComponentInstanceIndex, 240 callee: *mut VMFuncRef, 241 callee_instance: RuntimeComponentInstanceIndex, 242 param_count: u32, 243 result_count: u32, 244 flags: u32, 245 ) -> Result<u32>; 246 247 /// The `future.new` intrinsic. 248 fn future_new( 249 &mut self, 250 instance: &mut ComponentInstance, 251 ty: TypeFutureTableIndex, 252 ) -> Result<u32>; 253 254 /// The `future.write` intrinsic. 255 fn future_write( 256 &mut self, 257 instance: &mut ComponentInstance, 258 memory: *mut VMMemoryDefinition, 259 realloc: *mut VMFuncRef, 260 string_encoding: u8, 261 ty: TypeFutureTableIndex, 262 future: u32, 263 address: u32, 264 ) -> Result<u32>; 265 266 /// The `future.read` intrinsic. 267 fn future_read( 268 &mut self, 269 instance: &mut ComponentInstance, 270 memory: *mut VMMemoryDefinition, 271 realloc: *mut VMFuncRef, 272 string_encoding: u8, 273 ty: TypeFutureTableIndex, 274 future: u32, 275 address: u32, 276 ) -> Result<u32>; 277 278 /// The `future.cancel-write` intrinsic. 279 fn future_cancel_write( 280 &mut self, 281 instance: &mut ComponentInstance, 282 ty: TypeFutureTableIndex, 283 async_: bool, 284 writer: u32, 285 ) -> Result<u32>; 286 287 /// The `future.cancel-read` intrinsic. 288 fn future_cancel_read( 289 &mut self, 290 instance: &mut ComponentInstance, 291 ty: TypeFutureTableIndex, 292 async_: bool, 293 reader: u32, 294 ) -> Result<u32>; 295 296 /// The `future.drop-writable` intrinsic. 297 fn future_drop_writable( 298 &mut self, 299 instance: &mut ComponentInstance, 300 ty: TypeFutureTableIndex, 301 writer: u32, 302 ) -> Result<()>; 303 304 /// The `future.drop-readable` intrinsic. 305 fn future_drop_readable( 306 &mut self, 307 instance: &mut ComponentInstance, 308 ty: TypeFutureTableIndex, 309 reader: u32, 310 ) -> Result<()>; 311 312 /// The `stream.new` intrinsic. 313 fn stream_new( 314 &mut self, 315 instance: &mut ComponentInstance, 316 ty: TypeStreamTableIndex, 317 ) -> Result<u32>; 318 319 /// The `stream.write` intrinsic. 320 fn stream_write( 321 &mut self, 322 instance: &mut ComponentInstance, 323 memory: *mut VMMemoryDefinition, 324 realloc: *mut VMFuncRef, 325 string_encoding: u8, 326 ty: TypeStreamTableIndex, 327 stream: u32, 328 address: u32, 329 count: u32, 330 ) -> Result<u32>; 331 332 /// The `stream.read` intrinsic. 333 fn stream_read( 334 &mut self, 335 instance: &mut ComponentInstance, 336 memory: *mut VMMemoryDefinition, 337 realloc: *mut VMFuncRef, 338 string_encoding: u8, 339 ty: TypeStreamTableIndex, 340 stream: u32, 341 address: u32, 342 count: u32, 343 ) -> Result<u32>; 344 345 /// The `stream.cancel-write` intrinsic. 346 fn stream_cancel_write( 347 &mut self, 348 instance: &mut ComponentInstance, 349 ty: TypeStreamTableIndex, 350 async_: bool, 351 writer: u32, 352 ) -> Result<u32>; 353 354 /// The `stream.cancel-read` intrinsic. 355 fn stream_cancel_read( 356 &mut self, 357 instance: &mut ComponentInstance, 358 ty: TypeStreamTableIndex, 359 async_: bool, 360 reader: u32, 361 ) -> Result<u32>; 362 363 /// The `stream.drop-writable` intrinsic. 364 fn stream_drop_writable( 365 &mut self, 366 instance: &mut ComponentInstance, 367 ty: TypeStreamTableIndex, 368 writer: u32, 369 ) -> Result<()>; 370 371 /// The `stream.drop-readable` intrinsic. 372 fn stream_drop_readable( 373 &mut self, 374 instance: &mut ComponentInstance, 375 ty: TypeStreamTableIndex, 376 reader: u32, 377 ) -> Result<()>; 378 379 /// The "fast-path" implementation of the `stream.write` intrinsic for 380 /// "flat" (i.e. memcpy-able) payloads. 381 fn flat_stream_write( 382 &mut self, 383 instance: &mut ComponentInstance, 384 memory: *mut VMMemoryDefinition, 385 realloc: *mut VMFuncRef, 386 ty: TypeStreamTableIndex, 387 payload_size: u32, 388 payload_align: u32, 389 stream: u32, 390 address: u32, 391 count: u32, 392 ) -> Result<u32>; 393 394 /// The "fast-path" implementation of the `stream.read` intrinsic for "flat" 395 /// (i.e. memcpy-able) payloads. 396 fn flat_stream_read( 397 &mut self, 398 instance: &mut ComponentInstance, 399 memory: *mut VMMemoryDefinition, 400 realloc: *mut VMFuncRef, 401 ty: TypeStreamTableIndex, 402 payload_size: u32, 403 payload_align: u32, 404 stream: u32, 405 address: u32, 406 count: u32, 407 ) -> Result<u32>; 408 409 /// The `error-context.new` intrinsic. 410 fn error_context_new( 411 &mut self, 412 instance: &mut ComponentInstance, 413 memory: *mut VMMemoryDefinition, 414 realloc: *mut VMFuncRef, 415 string_encoding: u8, 416 ty: TypeComponentLocalErrorContextTableIndex, 417 debug_msg_address: u32, 418 debug_msg_len: u32, 419 ) -> Result<u32>; 420 421 /// The `error-context.debug-message` intrinsic. 422 fn error_context_debug_message( 423 &mut self, 424 instance: &mut ComponentInstance, 425 memory: *mut VMMemoryDefinition, 426 realloc: *mut VMFuncRef, 427 string_encoding: u8, 428 ty: TypeComponentLocalErrorContextTableIndex, 429 err_ctx_handle: u32, 430 debug_msg_address: u32, 431 ) -> Result<()>; 432 433 /// The `error-context.drop` intrinsic. 434 fn error_context_drop( 435 &mut self, 436 instance: &mut ComponentInstance, 437 ty: TypeComponentLocalErrorContextTableIndex, 438 err_ctx_handle: u32, 439 ) -> Result<()>; 440 } 441 442 unsafe impl<T> VMComponentAsyncStore for StoreInner<T> { 443 fn backpressure_set( 444 &mut self, 445 caller_instance: RuntimeComponentInstanceIndex, 446 enabled: u32, 447 ) -> Result<()> { 448 _ = (caller_instance, enabled); 449 todo!() 450 } 451 452 fn task_return( 453 &mut self, 454 instance: &mut ComponentInstance, 455 ty: TypeTupleIndex, 456 storage: *mut ValRaw, 457 storage_len: usize, 458 ) -> Result<()> { 459 _ = (instance, ty, storage, storage_len); 460 todo!() 461 } 462 463 fn waitable_set_new( 464 &mut self, 465 instance: &mut ComponentInstance, 466 caller_instance: RuntimeComponentInstanceIndex, 467 ) -> Result<u32> { 468 _ = (instance, caller_instance); 469 todo!(); 470 } 471 472 fn waitable_set_wait( 473 &mut self, 474 instance: &mut ComponentInstance, 475 caller_instance: RuntimeComponentInstanceIndex, 476 set: u32, 477 async_: bool, 478 memory: *mut VMMemoryDefinition, 479 payload: u32, 480 ) -> Result<u32> { 481 _ = (instance, caller_instance, set, async_, memory, payload); 482 todo!(); 483 } 484 485 fn waitable_set_poll( 486 &mut self, 487 instance: &mut ComponentInstance, 488 caller_instance: RuntimeComponentInstanceIndex, 489 set: u32, 490 async_: bool, 491 memory: *mut VMMemoryDefinition, 492 payload: u32, 493 ) -> Result<u32> { 494 _ = (instance, caller_instance, set, async_, memory, payload); 495 todo!(); 496 } 497 498 fn waitable_set_drop( 499 &mut self, 500 instance: &mut ComponentInstance, 501 caller_instance: RuntimeComponentInstanceIndex, 502 set: u32, 503 ) -> Result<()> { 504 _ = (instance, caller_instance, set); 505 todo!(); 506 } 507 508 fn waitable_join( 509 &mut self, 510 instance: &mut ComponentInstance, 511 caller_instance: RuntimeComponentInstanceIndex, 512 set: u32, 513 waitable: u32, 514 ) -> Result<()> { 515 _ = (instance, caller_instance, set, waitable); 516 todo!(); 517 } 518 519 fn yield_(&mut self, instance: &mut ComponentInstance, async_: bool) -> Result<()> { 520 _ = (instance, async_); 521 todo!() 522 } 523 524 fn subtask_drop( 525 &mut self, 526 instance: &mut ComponentInstance, 527 caller_instance: RuntimeComponentInstanceIndex, 528 task_id: u32, 529 ) -> Result<()> { 530 _ = (instance, caller_instance, task_id); 531 todo!() 532 } 533 534 fn sync_enter( 535 &mut self, 536 start: *mut VMFuncRef, 537 return_: *mut VMFuncRef, 538 caller_instance: RuntimeComponentInstanceIndex, 539 task_return_type: TypeTupleIndex, 540 result_count: u32, 541 storage: *mut ValRaw, 542 storage_len: usize, 543 ) -> Result<()> { 544 _ = ( 545 start, 546 return_, 547 caller_instance, 548 task_return_type, 549 result_count, 550 storage, 551 storage_len, 552 ); 553 todo!() 554 } 555 556 fn sync_exit( 557 &mut self, 558 instance: &mut ComponentInstance, 559 callback: *mut VMFuncRef, 560 caller_instance: RuntimeComponentInstanceIndex, 561 callee: *mut VMFuncRef, 562 callee_instance: RuntimeComponentInstanceIndex, 563 param_count: u32, 564 storage: *mut MaybeUninit<ValRaw>, 565 storage_len: usize, 566 ) -> Result<()> { 567 _ = ( 568 instance, 569 callback, 570 caller_instance, 571 callee, 572 callee_instance, 573 param_count, 574 storage, 575 storage_len, 576 ); 577 todo!() 578 } 579 580 fn async_enter( 581 &mut self, 582 start: *mut VMFuncRef, 583 return_: *mut VMFuncRef, 584 caller_instance: RuntimeComponentInstanceIndex, 585 task_return_type: TypeTupleIndex, 586 params: u32, 587 results: u32, 588 ) -> Result<()> { 589 _ = ( 590 start, 591 return_, 592 caller_instance, 593 task_return_type, 594 params, 595 results, 596 ); 597 todo!() 598 } 599 600 fn async_exit( 601 &mut self, 602 instance: &mut ComponentInstance, 603 callback: *mut VMFuncRef, 604 post_return: *mut VMFuncRef, 605 caller_instance: RuntimeComponentInstanceIndex, 606 callee: *mut VMFuncRef, 607 callee_instance: RuntimeComponentInstanceIndex, 608 param_count: u32, 609 result_count: u32, 610 flags: u32, 611 ) -> Result<u32> { 612 _ = ( 613 instance, 614 callback, 615 post_return, 616 caller_instance, 617 callee, 618 callee_instance, 619 param_count, 620 result_count, 621 flags, 622 ); 623 todo!() 624 } 625 626 fn future_new( 627 &mut self, 628 instance: &mut ComponentInstance, 629 ty: TypeFutureTableIndex, 630 ) -> Result<u32> { 631 _ = (instance, ty); 632 todo!() 633 } 634 635 fn future_write( 636 &mut self, 637 instance: &mut ComponentInstance, 638 memory: *mut VMMemoryDefinition, 639 realloc: *mut VMFuncRef, 640 string_encoding: u8, 641 ty: TypeFutureTableIndex, 642 future: u32, 643 address: u32, 644 ) -> Result<u32> { 645 _ = ( 646 instance, 647 memory, 648 realloc, 649 string_encoding, 650 ty, 651 future, 652 address, 653 ); 654 todo!() 655 } 656 657 fn future_read( 658 &mut self, 659 instance: &mut ComponentInstance, 660 memory: *mut VMMemoryDefinition, 661 realloc: *mut VMFuncRef, 662 string_encoding: u8, 663 ty: TypeFutureTableIndex, 664 future: u32, 665 address: u32, 666 ) -> Result<u32> { 667 _ = ( 668 instance, 669 memory, 670 realloc, 671 string_encoding, 672 ty, 673 future, 674 address, 675 ); 676 todo!() 677 } 678 679 fn future_cancel_write( 680 &mut self, 681 instance: &mut ComponentInstance, 682 ty: TypeFutureTableIndex, 683 async_: bool, 684 writer: u32, 685 ) -> Result<u32> { 686 _ = (instance, ty, async_, writer); 687 todo!() 688 } 689 690 fn future_cancel_read( 691 &mut self, 692 instance: &mut ComponentInstance, 693 ty: TypeFutureTableIndex, 694 async_: bool, 695 reader: u32, 696 ) -> Result<u32> { 697 _ = (instance, ty, async_, reader); 698 todo!() 699 } 700 701 fn future_drop_writable( 702 &mut self, 703 instance: &mut ComponentInstance, 704 ty: TypeFutureTableIndex, 705 writer: u32, 706 ) -> Result<()> { 707 _ = (instance, ty, writer); 708 todo!() 709 } 710 711 fn future_drop_readable( 712 &mut self, 713 instance: &mut ComponentInstance, 714 ty: TypeFutureTableIndex, 715 reader: u32, 716 ) -> Result<()> { 717 _ = (instance, ty, reader); 718 todo!() 719 } 720 721 fn stream_new( 722 &mut self, 723 instance: &mut ComponentInstance, 724 ty: TypeStreamTableIndex, 725 ) -> Result<u32> { 726 _ = (instance, ty); 727 todo!() 728 } 729 730 fn stream_write( 731 &mut self, 732 instance: &mut ComponentInstance, 733 memory: *mut VMMemoryDefinition, 734 realloc: *mut VMFuncRef, 735 string_encoding: u8, 736 ty: TypeStreamTableIndex, 737 stream: u32, 738 address: u32, 739 count: u32, 740 ) -> Result<u32> { 741 _ = ( 742 instance, 743 memory, 744 realloc, 745 string_encoding, 746 ty, 747 stream, 748 address, 749 count, 750 ); 751 todo!() 752 } 753 754 fn stream_read( 755 &mut self, 756 instance: &mut ComponentInstance, 757 memory: *mut VMMemoryDefinition, 758 realloc: *mut VMFuncRef, 759 string_encoding: u8, 760 ty: TypeStreamTableIndex, 761 stream: u32, 762 address: u32, 763 count: u32, 764 ) -> Result<u32> { 765 _ = ( 766 instance, 767 memory, 768 realloc, 769 string_encoding, 770 ty, 771 stream, 772 address, 773 count, 774 ); 775 todo!() 776 } 777 778 fn stream_cancel_write( 779 &mut self, 780 instance: &mut ComponentInstance, 781 ty: TypeStreamTableIndex, 782 async_: bool, 783 writer: u32, 784 ) -> Result<u32> { 785 _ = (instance, ty, async_, writer); 786 todo!() 787 } 788 789 fn stream_cancel_read( 790 &mut self, 791 instance: &mut ComponentInstance, 792 ty: TypeStreamTableIndex, 793 async_: bool, 794 reader: u32, 795 ) -> Result<u32> { 796 _ = (instance, ty, async_, reader); 797 todo!() 798 } 799 800 fn stream_drop_writable( 801 &mut self, 802 instance: &mut ComponentInstance, 803 ty: TypeStreamTableIndex, 804 writer: u32, 805 ) -> Result<()> { 806 _ = (instance, ty, writer); 807 todo!() 808 } 809 810 fn stream_drop_readable( 811 &mut self, 812 instance: &mut ComponentInstance, 813 ty: TypeStreamTableIndex, 814 reader: u32, 815 ) -> Result<()> { 816 _ = (instance, ty, reader); 817 todo!() 818 } 819 820 fn flat_stream_write( 821 &mut self, 822 instance: &mut ComponentInstance, 823 memory: *mut VMMemoryDefinition, 824 realloc: *mut VMFuncRef, 825 ty: TypeStreamTableIndex, 826 payload_size: u32, 827 payload_align: u32, 828 stream: u32, 829 address: u32, 830 count: u32, 831 ) -> Result<u32> { 832 _ = ( 833 instance, 834 memory, 835 realloc, 836 ty, 837 payload_size, 838 payload_align, 839 stream, 840 address, 841 count, 842 ); 843 todo!() 844 } 845 846 fn flat_stream_read( 847 &mut self, 848 instance: &mut ComponentInstance, 849 memory: *mut VMMemoryDefinition, 850 realloc: *mut VMFuncRef, 851 ty: TypeStreamTableIndex, 852 payload_size: u32, 853 payload_align: u32, 854 stream: u32, 855 address: u32, 856 count: u32, 857 ) -> Result<u32> { 858 _ = ( 859 instance, 860 memory, 861 realloc, 862 ty, 863 payload_size, 864 payload_align, 865 stream, 866 address, 867 count, 868 ); 869 todo!() 870 } 871 872 fn error_context_new( 873 &mut self, 874 instance: &mut ComponentInstance, 875 memory: *mut VMMemoryDefinition, 876 realloc: *mut VMFuncRef, 877 string_encoding: u8, 878 ty: TypeComponentLocalErrorContextTableIndex, 879 debug_msg_address: u32, 880 debug_msg_len: u32, 881 ) -> Result<u32> { 882 _ = ( 883 instance, 884 memory, 885 realloc, 886 string_encoding, 887 ty, 888 debug_msg_address, 889 debug_msg_len, 890 ); 891 todo!() 892 } 893 894 fn error_context_debug_message( 895 &mut self, 896 instance: &mut ComponentInstance, 897 memory: *mut VMMemoryDefinition, 898 realloc: *mut VMFuncRef, 899 string_encoding: u8, 900 ty: TypeComponentLocalErrorContextTableIndex, 901 err_ctx_handle: u32, 902 debug_msg_address: u32, 903 ) -> Result<()> { 904 _ = ( 905 instance, 906 memory, 907 realloc, 908 string_encoding, 909 ty, 910 err_ctx_handle, 911 debug_msg_address, 912 ); 913 todo!() 914 } 915 916 fn error_context_drop( 917 &mut self, 918 instance: &mut ComponentInstance, 919 ty: TypeComponentLocalErrorContextTableIndex, 920 err_ctx_handle: u32, 921 ) -> Result<()> { 922 _ = (instance, ty, err_ctx_handle); 923 todo!() 924 } 925 } 926