Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ members = [
]

[workspace.dependencies]
wit-bindgen = "0.58.0"
wit-bindgen = { version = "0.58.0", git = "https://github.com/bytecodealliance/wit-bindgen.git", branch = "main" }
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ components: $(foreach component,$(COMPONENTS),lib/$(component).wasm $(foreach co

define BUILD_COMPONENT

.PHONY: components/$1
components/$1: lib/$1.wasm lib/$1.debug.wasm

lib/$1.wasm: Cargo.toml Cargo.lock wit/deps $(shell find components/$1 -type f)
cargo build -p $1 --target wasm32-unknown-unknown --release
wasm-tools component new target/wasm32-unknown-unknown/release/$(subst -,_,$1).wasm -o lib/$1.wasm
Expand Down
21 changes: 16 additions & 5 deletions components/stderr-to-stdout/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#![no_main]

use crate::exports::wasi::cli::stderr::Guest;
use crate::wasi::cli::stdout::get_stdout;
use crate::wasi::io::streams::OutputStream;
use crate::exports::wasi::cli::stderr::{ErrorCode, Guest};
use crate::wasi::cli::stdout;

pub(crate) struct StderrToStdout;

impl Guest for StderrToStdout {
fn get_stderr() -> OutputStream {
get_stdout()
#[doc = "/ Write the given stream to stderr."]
#[doc = "/"]
#[doc = "/ If the stream\'s writable end is dropped this function will either return"]
#[doc = "/ success once the entire contents of the stream have been written or an"]
#[doc = "/ error-code representing a failure."]
#[doc = "/"]
#[doc = "/ Otherwise if there is an error the readable end of the stream will be"]
#[doc = "/ dropped and this function will return an error-code."]
#[allow(async_fn_in_trait)]
fn write_via_stream(
data: wit_bindgen::rt::async_support::StreamReader<u8>,
) -> wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>> {
stdout::write_via_stream(data)
}
}

wit_bindgen::generate!({
path: "../../wit",
world: "stderr-to-stdout",
merge_structurally_equal_types: true,
generate_all
});

Expand Down
21 changes: 16 additions & 5 deletions components/stdout-to-stderr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#![no_main]

use crate::exports::wasi::cli::stdout::Guest;
use crate::wasi::cli::stderr::get_stderr;
use crate::wasi::io::streams::OutputStream;
use crate::exports::wasi::cli::stdout::{ErrorCode, Guest};
use crate::wasi::cli::stderr;

pub(crate) struct StdoutToStderr;

impl Guest for StdoutToStderr {
fn get_stdout() -> OutputStream {
get_stderr()
#[doc = "/ Write the given stream to stdout."]
#[doc = "/"]
#[doc = "/ If the stream\'s writable end is dropped this function will either return"]
#[doc = "/ success once the entire contents of the stream have been written or an"]
#[doc = "/ error-code representing a failure."]
#[doc = "/"]
#[doc = "/ Otherwise if there is an error the readable end of the stream will be"]
#[doc = "/ dropped and this function will return an error-code."]
#[allow(async_fn_in_trait)]
fn write_via_stream(
data: wit_bindgen::rt::async_support::StreamReader<u8>,
) -> wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>> {
stderr::write_via_stream(data)
}
}

wit_bindgen::generate!({
path: "../../wit",
world: "stdout-to-stderr",
merge_structurally_equal_types: true,
generate_all
});

Expand Down
261 changes: 0 additions & 261 deletions wit/deps/wasi-cli-0.2.6/package.wit

This file was deleted.

Loading