Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rvolosatovs committed Jan 14, 2025
2 parents c5df716 + 5928056 commit 63876a2
Show file tree
Hide file tree
Showing 17 changed files with 589 additions and 255 deletions.
138 changes: 42 additions & 96 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,19 @@ uuid = { version = "1", default-features = false }
wasi = { version = "0.13", default-features = false }
wasi-preview1-component-adapter-provider = { version = "27", default-features = false }
wasm-tokio = { version = "0.6", default-features = false }
wasmparser = { version = "0.221", default-features = false }
wasmparser = { version = "0.223", default-features = false }
wasmtime = { version = "27", default-features = false }
wasmtime-cli-flags = { version = "27", default-features = false }
wasmtime-wasi = { version = "27", default-features = false }
wasmtime-wasi-http = { version = "27", default-features = false }
wit-bindgen = { version = "0.36", default-features = false }
wit-bindgen-core = { version = "0.36", default-features = false }
wit-bindgen = { version = "0.37", default-features = false }
wit-bindgen-core = { version = "0.37", default-features = false }
wit-bindgen-wrpc = { version = "0.9", default-features = false, path = "./crates/wit-bindgen" }
wit-bindgen-wrpc-go = { version = "0.11", default-features = false, path = "./crates/wit-bindgen-go" }
wit-bindgen-wrpc-rust = { version = "0.9", default-features = false, path = "./crates/wit-bindgen-rust" }
wit-bindgen-wrpc-rust-macro = { version = "0.9", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
wit-component = { version = "0.221", default-features = false }
wit-parser = { version = "0.220", default-features = false }
wit-component = { version = "0.223", default-features = false }
wit-parser = { version = "0.223", default-features = false }
wrpc-cli = { version = "0.5", path = "./crates/cli", default-features = false }
wrpc-introspect = { version = "0.6", default-features = false, path = "./crates/introspect" }
wrpc-runtime-wasmtime = { version = "0.26", path = "./crates/runtime-wasmtime", default-features = false }
Expand Down
23 changes: 11 additions & 12 deletions crates/introspect/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::collections::{BTreeSet, VecDeque};

use wit_parser::{
Case, Field, Flags, Function, FunctionKind, Handle, Int, Record, Resolve, Stream, Type,
TypeDefKind, TypeId,
Case, Field, Flags, Function, FunctionKind, Handle, Int, Record, Resolve, Type, TypeDefKind,
TypeId,
};

#[must_use]
Expand Down Expand Up @@ -188,22 +188,21 @@ pub fn async_paths_tyid(resolve: &Resolve, id: TypeId) -> (BTreeSet<VecDeque<Opt
}
(paths, true)
}
TypeDefKind::Stream(Stream { element, .. }) => {
TypeDefKind::Stream(ty) => {
let mut paths = BTreeSet::new();
if let Some(ty) = element {
let (nested, fut) = async_paths_ty(resolve, ty);
for mut path in nested {
path.push_front(None);
paths.insert(path);
}
if fut {
paths.insert(vec![None].into());
}
let (nested, fut) = async_paths_ty(resolve, ty);
for mut path in nested {
path.push_front(None);
paths.insert(path);
}
if fut {
paths.insert(vec![None].into());
}
(paths.into_iter().collect(), true)
}
TypeDefKind::Type(ty) => async_paths_ty(resolve, ty),
TypeDefKind::Resource
| TypeDefKind::ErrorContext
| TypeDefKind::Flags(..)
| TypeDefKind::Enum(..)
| TypeDefKind::Handle(Handle::Own(..) | Handle::Borrow(..)) => (BTreeSet::default(), false),
Expand Down
3 changes: 2 additions & 1 deletion crates/test-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ pub fn test_directory(suite_name: &str, gen_name: &str, wit_name: &str) -> PathB
/// Helper function to execute a process during tests and print informative
/// information if it fails.
pub fn run_command(cmd: &mut Command) {
let command = format!("{cmd:?}");
let output = cmd
.output()
.expect("failed to run executable; is it installed");
.unwrap_or_else(|e| panic!("failed to run executable: {e}; command was `{command}`"));

if output.status.success() {
return;
Expand Down
4 changes: 4 additions & 0 deletions crates/transport/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,12 @@ pub trait TupleDecode<R>: Decode<R> {}
impl<W> Encode<W> for () {
type Encoder = UnitCodec;
}
impl<W> Encode<W> for &() {
type Encoder = UnitCodec;
}

impl<W> TupleEncode<W> for () {}
impl<W> TupleEncode<W> for &() {}

impl<R> Decode<R> for () {
type Decoder = UnitCodec;
Expand Down
Loading

0 comments on commit 63876a2

Please sign in to comment.