20
20
future:: { self , FutureExt } ,
21
21
stream:: { FuturesUnordered , StreamExt } ,
22
22
} ,
23
- futures_and_streams:: { FlatAbi , StreamFutureState , TableIndex , TransmitHandle } ,
23
+ futures_and_streams:: { FlatAbi , ReturnCode , StreamFutureState , TableIndex , TransmitHandle } ,
24
24
once_cell:: sync:: Lazy ,
25
25
ready_chunks:: ReadyChunks ,
26
26
states:: StateTable ,
@@ -99,21 +99,21 @@ enum Event {
99
99
CallStarted ,
100
100
CallReturned ,
101
101
StreamRead {
102
- count : u32 ,
102
+ code : ReturnCode ,
103
103
handle : u32 ,
104
104
ty : TypeStreamTableIndex ,
105
105
} ,
106
106
StreamWrite {
107
- count : u32 ,
107
+ code : ReturnCode ,
108
108
pending : Option < ( TypeStreamTableIndex , u32 ) > ,
109
109
} ,
110
110
FutureRead {
111
- count : u32 ,
111
+ code : ReturnCode ,
112
112
handle : u32 ,
113
113
ty : TypeFutureTableIndex ,
114
114
} ,
115
115
FutureWrite {
116
- count : u32 ,
116
+ code : ReturnCode ,
117
117
pending : Option < ( TypeFutureTableIndex , u32 ) > ,
118
118
} ,
119
119
}
@@ -125,10 +125,10 @@ impl Event {
125
125
Event :: _CallStarting => ( 1 , 0 ) ,
126
126
Event :: CallStarted => ( 2 , 0 ) ,
127
127
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 ( ) ) ,
132
132
}
133
133
}
134
134
}
@@ -2820,18 +2820,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2820
2820
future : u32 ,
2821
2821
address : u32 ,
2822
2822
) -> 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 ( ) )
2835
2837
}
2836
2838
2837
2839
fn future_read (
@@ -2845,18 +2847,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2845
2847
future : u32 ,
2846
2848
address : u32 ,
2847
2849
) -> 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 ( ) )
2860
2864
}
2861
2865
2862
2866
fn stream_write (
@@ -2871,18 +2875,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2871
2875
address : u32 ,
2872
2876
count : u32 ,
2873
2877
) -> 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 ( ) )
2886
2892
}
2887
2893
2888
2894
fn stream_read (
@@ -2897,18 +2903,20 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2897
2903
address : u32 ,
2898
2904
count : u32 ,
2899
2905
) -> 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 ( ) )
2912
2920
}
2913
2921
2914
2922
fn flat_stream_write (
@@ -2924,21 +2932,23 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2924
2932
address : u32 ,
2925
2933
count : u32 ,
2926
2934
) -> 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 ( ) )
2942
2952
}
2943
2953
2944
2954
fn flat_stream_read (
@@ -2954,21 +2964,23 @@ unsafe impl<T> VMComponentAsyncStore for StoreInner<T> {
2954
2964
address : u32 ,
2955
2965
count : u32 ,
2956
2966
) -> 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 ( ) )
2972
2984
}
2973
2985
2974
2986
fn error_context_debug_message (
0 commit comments