2020 future:: { self , FutureExt } ,
2121 stream:: { FuturesUnordered , StreamExt } ,
2222 } ,
23- futures_and_streams:: { FlatAbi , StreamFutureState , TableIndex , TransmitHandle } ,
23+ futures_and_streams:: { FlatAbi , ReturnCode , StreamFutureState , TableIndex , TransmitHandle } ,
2424 once_cell:: sync:: Lazy ,
2525 ready_chunks:: ReadyChunks ,
2626 states:: StateTable ,
@@ -99,21 +99,21 @@ enum Event {
9999 CallStarted ,
100100 CallReturned ,
101101 StreamRead {
102- count : u32 ,
102+ code : ReturnCode ,
103103 handle : u32 ,
104104 ty : TypeStreamTableIndex ,
105105 } ,
106106 StreamWrite {
107- count : u32 ,
107+ code : ReturnCode ,
108108 pending : Option < ( TypeStreamTableIndex , u32 ) > ,
109109 } ,
110110 FutureRead {
111- count : u32 ,
111+ code : ReturnCode ,
112112 handle : u32 ,
113113 ty : TypeFutureTableIndex ,
114114 } ,
115115 FutureWrite {
116- count : u32 ,
116+ code : ReturnCode ,
117117 pending : Option < ( TypeFutureTableIndex , u32 ) > ,
118118 } ,
119119}
@@ -125,10 +125,10 @@ impl Event {
125125 Event :: _CallStarting => ( 1 , 0 ) ,
126126 Event :: CallStarted => ( 2 , 0 ) ,
127127 Event :: CallReturned => ( 3 , 0 ) ,
128- Event :: StreamRead { count , .. } => ( 5 , count ) ,
129- Event :: StreamWrite { count , .. } => ( 6 , count ) ,
130- Event :: FutureRead { count , .. } => ( 7 , count ) ,
131- Event :: FutureWrite { count , .. } => ( 8 , count ) ,
128+ Event :: StreamRead { code , .. } => ( 5 , code . encode ( ) ) ,
129+ Event :: StreamWrite { code , .. } => ( 6 , code . encode ( ) ) ,
130+ Event :: FutureRead { code , .. } => ( 7 , code . encode ( ) ) ,
131+ Event :: FutureWrite { code , .. } => ( 8 , code . encode ( ) ) ,
132132 }
133133 }
134134}
@@ -2820,18 +2820,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
28202820 future : u32 ,
28212821 address : u32 ,
28222822 ) -> Result < u32 > {
2823- instance. guest_write (
2824- StoreContextMut ( self ) ,
2825- memory,
2826- realloc,
2827- string_encoding,
2828- async_,
2829- TableIndex :: Future ( ty) ,
2830- None ,
2831- future,
2832- address,
2833- 1 ,
2834- )
2823+ instance
2824+ . guest_write (
2825+ StoreContextMut ( self ) ,
2826+ memory,
2827+ realloc,
2828+ string_encoding,
2829+ async_,
2830+ TableIndex :: Future ( ty) ,
2831+ None ,
2832+ future,
2833+ address,
2834+ 1 ,
2835+ )
2836+ . map ( |result| result. encode ( ) )
28352837 }
28362838
28372839 fn future_read (
@@ -2845,18 +2847,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
28452847 future : u32 ,
28462848 address : u32 ,
28472849 ) -> Result < u32 > {
2848- instance. guest_read (
2849- StoreContextMut ( self ) ,
2850- memory,
2851- realloc,
2852- string_encoding,
2853- async_,
2854- TableIndex :: Future ( ty) ,
2855- None ,
2856- future,
2857- address,
2858- 1 ,
2859- )
2850+ instance
2851+ . guest_read (
2852+ StoreContextMut ( self ) ,
2853+ memory,
2854+ realloc,
2855+ string_encoding,
2856+ async_,
2857+ TableIndex :: Future ( ty) ,
2858+ None ,
2859+ future,
2860+ address,
2861+ 1 ,
2862+ )
2863+ . map ( |result| result. encode ( ) )
28602864 }
28612865
28622866 fn stream_write (
@@ -2871,18 +2875,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
28712875 address : u32 ,
28722876 count : u32 ,
28732877 ) -> Result < u32 > {
2874- instance. guest_write (
2875- StoreContextMut ( self ) ,
2876- memory,
2877- realloc,
2878- string_encoding,
2879- async_,
2880- TableIndex :: Stream ( ty) ,
2881- None ,
2882- stream,
2883- address,
2884- count,
2885- )
2878+ instance
2879+ . guest_write (
2880+ StoreContextMut ( self ) ,
2881+ memory,
2882+ realloc,
2883+ string_encoding,
2884+ async_,
2885+ TableIndex :: Stream ( ty) ,
2886+ None ,
2887+ stream,
2888+ address,
2889+ count,
2890+ )
2891+ . map ( |result| result. encode ( ) )
28862892 }
28872893
28882894 fn stream_read (
@@ -2897,18 +2903,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
28972903 address : u32 ,
28982904 count : u32 ,
28992905 ) -> Result < u32 > {
2900- instance. guest_read (
2901- StoreContextMut ( self ) ,
2902- memory,
2903- realloc,
2904- string_encoding,
2905- async_,
2906- TableIndex :: Stream ( ty) ,
2907- None ,
2908- stream,
2909- address,
2910- count,
2911- )
2906+ instance
2907+ . guest_read (
2908+ StoreContextMut ( self ) ,
2909+ memory,
2910+ realloc,
2911+ string_encoding,
2912+ async_,
2913+ TableIndex :: Stream ( ty) ,
2914+ None ,
2915+ stream,
2916+ address,
2917+ count,
2918+ )
2919+ . map ( |result| result. encode ( ) )
29122920 }
29132921
29142922 fn flat_stream_write (
@@ -2924,21 +2932,23 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
29242932 address : u32 ,
29252933 count : u32 ,
29262934 ) -> Result < u32 > {
2927- instance. guest_write (
2928- StoreContextMut ( self ) ,
2929- memory,
2930- realloc,
2931- StringEncoding :: Utf8 as u8 ,
2932- async_,
2933- TableIndex :: Stream ( ty) ,
2934- Some ( FlatAbi {
2935- size : payload_size,
2936- align : payload_align,
2937- } ) ,
2938- stream,
2939- address,
2940- count,
2941- )
2935+ instance
2936+ . guest_write (
2937+ StoreContextMut ( self ) ,
2938+ memory,
2939+ realloc,
2940+ StringEncoding :: Utf8 as u8 ,
2941+ async_,
2942+ TableIndex :: Stream ( ty) ,
2943+ Some ( FlatAbi {
2944+ size : payload_size,
2945+ align : payload_align,
2946+ } ) ,
2947+ stream,
2948+ address,
2949+ count,
2950+ )
2951+ . map ( |result| result. encode ( ) )
29422952 }
29432953
29442954 fn flat_stream_read (
@@ -2954,21 +2964,23 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
29542964 address : u32 ,
29552965 count : u32 ,
29562966 ) -> Result < u32 > {
2957- instance. guest_read (
2958- StoreContextMut ( self ) ,
2959- memory,
2960- realloc,
2961- StringEncoding :: Utf8 as u8 ,
2962- async_,
2963- TableIndex :: Stream ( ty) ,
2964- Some ( FlatAbi {
2965- size : payload_size,
2966- align : payload_align,
2967- } ) ,
2968- stream,
2969- address,
2970- count,
2971- )
2967+ instance
2968+ . guest_read (
2969+ StoreContextMut ( self ) ,
2970+ memory,
2971+ realloc,
2972+ StringEncoding :: Utf8 as u8 ,
2973+ async_,
2974+ TableIndex :: Stream ( ty) ,
2975+ Some ( FlatAbi {
2976+ size : payload_size,
2977+ align : payload_align,
2978+ } ) ,
2979+ stream,
2980+ address,
2981+ count,
2982+ )
2983+ . map ( |result| result. encode ( ) )
29722984 }
29732985
29742986 fn error_context_debug_message (
0 commit comments