generated from oovm/RustTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support InputStream and OutputStream
- Loading branch information
Showing
9 changed files
with
93 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace package.io; | ||
|
||
|
||
#ffi("wasi:io/streams", "input-stream") | ||
resource class InputStream {} | ||
|
||
#ffi("wasi:cli/stdout", "get-stderr") | ||
function standard_input() -> InputStream {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace package.io; | ||
|
||
#ffi("wasi:io/error", "error") | ||
resource class IoError {} | ||
|
||
extends IoError { | ||
#ffi("wasi:io/error", "[method]to-debug-string") | ||
private to_debug_string(self) -> String { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace package.io; | ||
|
||
|
||
#ffi("wasi:io/streams", "output-stream") | ||
resource class OutputStream {} | ||
|
||
extends OutputStream { | ||
#ffi("wasi:io/streams", "write") | ||
function write(data: String) -> void {} | ||
} | ||
|
||
|
||
#ffi("wasi:cli/stdout", "get-stdout") | ||
function standard_output() -> OutputStream {} | ||
|
||
#ffi("wasi:cli/stdout", "get-stdin") | ||
function standard_error() -> OutputStream {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace package.io; | ||
|
||
#ffi("wasi:io/error", "error") | ||
resource class IoError {} | ||
|
||
extends IoError { | ||
#ffi("wasi:io/error", "[method]to-debug-string") | ||
private to_debug_string(self) -> String { | ||
|
||
} | ||
} | ||
|
||
#ffi("wasi:io/streams", "input-stream") | ||
resource class InputStream {} | ||
|
||
#ffi("wasi:cli/stdout", "get-stderr") | ||
function standard_input() -> InputStream {} | ||
|
||
|
||
#ffi("wasi:io/streams", "output-stream") | ||
resource class OutputStream {} | ||
|
||
|
||
#ffi("wasi:cli/stdout", "get-stdout") | ||
function standard_output() -> OutputStream {} | ||
|
||
|
||
|
||
#ffi("wasi:cli/stdout", "get-stdin") | ||
function standard_error() -> OutputStream {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
namespace package.random; | ||
|
||
🗨 Get a cryptographically secure random number as a random seed | ||
#ffi("wasi:random", "get-insecure-random-u64") | ||
micro random_seed_fast() : u64 { | ||
#ffi("wasi:random/random", "get-random-u64") | ||
micro random_seed_safe() : u64 { | ||
|
||
} | ||
|
||
~ Get a cryptographically secure random number as a random seed | ||
#ffi("wasi:random", "get-random-u64") | ||
micro random_seed_safe() : u64 { | ||
🗨 Get a cryptographically secure random number as a random seed | ||
#ffi("wasi:random/random", "get-insecure-random-u64") | ||
micro random_seed_fast() : u64 { | ||
|
||
} | ||
|
||
🗨 Get a cryptographically secure random number as a random seed | ||
#ffi("wasi:random", "get-random-bytes") | ||
micro random_bytes_safe(length: u64) : Vector<u8> { | ||
#ffi("wasi:random/random", "get-random-bytes") | ||
micro random_bytes_safe(length: u64): Array<u8> { | ||
|
||
} | ||
|
||
🗨 Get a fast random number seed | ||
#ffi("wasi:random", "get-insecure-random-bytes") | ||
micro random_bytes_fast(length: u64) : Vector<u8> { | ||
#ffi("wasi:random/random", "get-insecure-random-bytes") | ||
micro random_bytes_fast(length: u64): Array<u8> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
#external class Time { | ||
_secs: u64, | ||
_nanos: u32, | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
#native class Duration { | ||
_secs: u64, | ||
_nanos: u32, | ||
} | ||