@@ -119,7 +119,6 @@ interface get-stream-async {
119119 get-stream-future-string : async func (vals : list <future <string >>) -> stream <future <string >>;
120120}
121121
122-
123122interface get-future-async {
124123 use resources . {example-resource };
125124 use example-types . {example-variant , example-enum , example-record , example-flags };
@@ -189,7 +188,7 @@ interface get-future-async {
189188 // The unspooled version should take advantage of host->host optimizations
190189 get-future-stream-string : async func (vals : stream <string >) -> future <stream <string >>;
191190
192- // The spooled version returns a *new* stream that forces transit through the component
191+ // The spooled version returns a *new* stream that forces transit through the component
193192 get-future-stream-string-spool : async func (vals : list <string >) -> future <stream <string >>;
194193}
195194
@@ -257,16 +256,16 @@ world basic-run-string {
257256 export local-run-string ;
258257}
259258
260- //////////////////
261- // Stream Usage //
262- //////////////////
259+ //////////////////////
260+ // Stream lowerings //
261+ //////////////////////
263262
264- interface use- stream-sync {
265- // TODO(fix): optimize host-only stream usage -- detect when the read & write are held by the host
263+ interface stream-lower -sync {
264+ // TODO(fix): optimize host-only stream usage -- detect when the read & write are held by the host
266265 stream-passthrough : func (s : stream <u32 >) -> stream <u32 >;
267266}
268267
269- interface use- stream-async {
268+ interface stream-lower -async {
270269 use resources . {example-resource };
271270 use example-types . {example-variant , example-enum , example-record , example-flags };
272271
@@ -317,12 +316,91 @@ interface use-stream-async {
317316
318317 read-stream-values-stream-string : async func (s : stream <stream <string >>) -> list <list <string >>;
319318
320- // read-stream-values-future-string: async func(vals: list <future<string>>) -> result<stream<future<string>>, string>;
319+ read-stream-values-future-string : async func (vals : stream <future <string >>) -> list < string >;
321320}
322321
323- world stream-rx {
322+ world stream-lower {
324323 import resources ;
325324
326- export use-stream-sync ;
327- export use-stream-async ;
328- }
325+ export stream-lower-sync ;
326+ export stream-lower-async ;
327+ }
328+
329+ //////////////////////
330+ // Future lowerings //
331+ //////////////////////
332+
333+ interface future-lower-sync {
334+ // TODO(fix): optimize host-only stream usage -- detect when the read & write are held by the host
335+ future-passthrough : func (s : future <u32 >) -> future <u32 >;
336+ }
337+
338+ interface future-lower-async {
339+ use resources . {example-resource };
340+ use example-types . {example-variant , example-enum , example-record , example-flags };
341+
342+ future-passthrough : async func (s : future <u32 >) -> future <u32 >;
343+
344+ read-future-value-bool : async func (f : future <bool >) -> bool ;
345+
346+ read-future-value-u32 : async func (f : future <u32 >) -> u32 ;
347+ read-future-value-s32 : async func (f : future <s32 >) -> s32 ;
348+
349+ read-future-value-u8 : async func (f : future <u8 >) -> u8 ;
350+ read-future-value-s8 : async func (f : future <s8 >) -> s8 ;
351+
352+ read-future-value-u16 : async func (f : future <u16 >) -> u16 ;
353+ read-future-value-s16 : async func (f : future <s16 >) -> s16 ;
354+
355+ read-future-value-u64 : async func (f : future <u64 >) -> u64 ;
356+ read-future-value-s64 : async func (f : future <s64 >) -> s64 ;
357+
358+ read-future-value-f32 : async func (f : future <f32 >) -> f32 ;
359+
360+ read-future-value-f64 : async func (f : future <f64 >) -> f64 ;
361+
362+ // NOTE: future<char> is not yet supported upfuture (future<u8> can be used instead)
363+ //
364+ // get-future-char: async func(vals: list<char>) -> result<future<char>, string>;
365+
366+ read-future-value-string : async func (f : future <string >) -> string ;
367+
368+ read-future-value-record : async func (f : future <example-record >) -> example-record ;
369+
370+ read-future-value-variant : async func (f : future <example-variant >) -> example-variant ;
371+
372+ read-future-value-list-u8 : async func (f : future <list <u8 >>) -> list <u8 >;
373+ read-future-value-list-string : async func (f : future <list <string >>) -> list <string >;
374+ read-future-value-list-record : async func (f : future <list <example-record >>) -> list <example-record >;
375+ read-future-value-fixed-list-u32 : async func (f : future <list <u32 , 5 >>) -> list <u32 , 5 >;
376+
377+ read-future-value-tuple : async func (f : future <tuple <u32 , s32 , string >>) -> tuple <u32 , s32 , string >;
378+
379+ read-future-value-flags : async func (f : future <example-flags >) -> example-flags ;
380+
381+ read-future-value-enum : async func (f : future <example-enum >) -> example-enum ;
382+
383+ read-future-value-option-string : async func (f : future <option <string >>) -> option <string >;
384+
385+ read-future-value-result-string : async func (f : future <result <string , string >>) -> result <string , string >;
386+
387+ // NOTE: future<borrow<t>> is not supoprted
388+ //
389+ // get-future-example-resource-borrow: async func(
390+ // vals: list<borrow<example-resource>>
391+ // ) -> result<future<borrow<example-resource>>, string>;
392+
393+ read-future-value-example-resource-own : async func (s : future <example-resource >);
394+
395+ read-future-value-example-resource-own-attr : async func (s : future <example-resource >) -> u32 ;
396+
397+ read-future-value-future-string : async func (f : future <future <string >>) -> string ;
398+
399+ read-future-value-stream-string : async func (vals : future <stream <string >>) -> list <string >;
400+ }
401+
402+ world future-lower {
403+ import resources ;
404+ export future-lower-sync ;
405+ export future-lower-async ;
406+ }
0 commit comments