1;;! component_model_async = true 2 3;; stream.new 4(component 5 (core module $m 6 (import "" "stream.new" (func $stream-new (result i64))) 7 ) 8 (type $stream-type (stream u8)) 9 (core func $stream-new (canon stream.new $stream-type)) 10 (core instance $i (instantiate $m (with "" (instance (export "stream.new" (func $stream-new)))))) 11) 12 13;; stream.read 14(component 15 (core module $libc (memory (export "memory") 1)) 16 (core instance $libc (instantiate $libc)) 17 (core module $m 18 (import "" "stream.read" (func $stream-read (param i32 i32 i32) (result i32))) 19 ) 20 (type $stream-type (stream u8)) 21 (core func $stream-read (canon stream.read $stream-type async (memory $libc "memory"))) 22 (core instance $i (instantiate $m (with "" (instance (export "stream.read" (func $stream-read)))))) 23) 24 25;; stream.read; with realloc 26(component 27 (core module $libc 28 (func (export "realloc") (param i32 i32 i32 i32) (result i32) unreachable) 29 (memory (export "memory") 1) 30 ) 31 (core instance $libc (instantiate $libc)) 32 (core module $m 33 (import "" "stream.read" (func $stream-read (param i32 i32 i32) (result i32))) 34 ) 35 (type $stream-type (stream string)) 36 (core func $stream-read (canon stream.read $stream-type async (memory $libc "memory") (realloc (func $libc "realloc")))) 37 (core instance $i (instantiate $m (with "" (instance (export "stream.read" (func $stream-read)))))) 38) 39 40;; stream.write 41(component 42 (core module $libc (memory (export "memory") 1)) 43 (core instance $libc (instantiate $libc)) 44 (core module $m 45 (import "" "stream.write" (func $stream-write (param i32 i32 i32) (result i32))) 46 ) 47 (type $stream-type (stream u8)) 48 (core func $stream-write (canon stream.write $stream-type async (memory $libc "memory"))) 49 (core instance $i (instantiate $m (with "" (instance (export "stream.write" (func $stream-write)))))) 50) 51 52;; stream.cancel-read 53(component 54 (core module $m 55 (import "" "stream.cancel-read" (func $stream-cancel-read (param i32) (result i32))) 56 ) 57 (type $stream-type (stream u8)) 58 (core func $stream-cancel-read (canon stream.cancel-read $stream-type)) 59 (core instance $i (instantiate $m (with "" (instance (export "stream.cancel-read" (func $stream-cancel-read)))))) 60) 61 62;; stream.cancel-write 63(component 64 (core module $m 65 (import "" "stream.cancel-write" (func $stream-cancel-write (param i32) (result i32))) 66 ) 67 (type $stream-type (stream u8)) 68 (core func $stream-cancel-write (canon stream.cancel-write $stream-type)) 69 (core instance $i (instantiate $m (with "" (instance (export "stream.cancel-write" (func $stream-cancel-write)))))) 70) 71 72;; stream.drop-readable 73(component 74 (core module $m 75 (import "" "stream.drop-readable" (func $stream-drop-readable (param i32))) 76 ) 77 (type $stream-type (stream u8)) 78 (core func $stream-drop-readable (canon stream.drop-readable $stream-type)) 79 (core instance $i (instantiate $m (with "" (instance (export "stream.drop-readable" (func $stream-drop-readable)))))) 80) 81 82;; stream.drop-writable 83(component 84 (core module $m 85 (import "" "stream.drop-writable" (func $stream-drop-writable (param i32))) 86 ) 87 (type $stream-type (stream u8)) 88 (core func $stream-drop-writable (canon stream.drop-writable $stream-type)) 89 (core instance $i (instantiate $m (with "" (instance (export "stream.drop-writable" (func $stream-drop-writable)))))) 90) 91