mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-15 01:41:21 +00:00
Pipe example
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1319,6 +1319,10 @@ dependencies = [
|
|||||||
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pipe"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.14"
|
version = "0.3.14"
|
||||||
|
@ -36,7 +36,7 @@ wasmer-wasi = { path = "lib/wasi", optional = true }
|
|||||||
kwasm-loader = { path = "lib/kwasm-loader" }
|
kwasm-loader = { path = "lib/kwasm-loader" }
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi", "lib/middleware-common", "lib/kwasm-loader", "examples/kernel/hello_world", "examples/plugin-for-example"]
|
members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi", "lib/middleware-common", "lib/kwasm-loader", "examples/kernel/hello_world", "examples/pipe", "examples/plugin-for-example"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wabt = "0.7.2"
|
wabt = "0.7.2"
|
||||||
|
7
examples/pipe/Cargo.toml
Normal file
7
examples/pipe/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "pipe"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Heyang Zhou <zhy20000919@hotmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
13
examples/pipe/src/main.rs
Normal file
13
examples/pipe/src/main.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut stdin = ::std::io::stdin();
|
||||||
|
let mut stdout = ::std::io::stdout();
|
||||||
|
let mut buf: Vec<u8> = vec![0; 512];
|
||||||
|
let mut total: u64 = 0;
|
||||||
|
while total < 1048576u64 * 2048 {
|
||||||
|
let n = stdin.read(&mut buf).unwrap();
|
||||||
|
stdout.write_all(&buf[..n]).unwrap();
|
||||||
|
total += n as u64;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user