Skip to content

Commit

Permalink
feat(runtime-wasmtime): sync codec with latest spec changes
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Jun 3, 2024
1 parent 520e221 commit 86d06a4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
26 changes: 24 additions & 2 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 @@ -117,7 +117,7 @@ tower = { version = "0.4", default-features = false }
tracing = { version = "0.1", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false }
url = { version = "2", default-features = false }
wasm-tokio = { version = "0.1", default-features = false }
wasm-tokio = { version = "0.4", default-features = false }
wasmcloud-component-adapters = { version = "0.9", default-features = false }
wasmparser = { version = "0.208", default-features = false }
wasmtime = { version = "21", default-features = false }
Expand Down
12 changes: 7 additions & 5 deletions crates/runtime-wasmtime/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::type_complexity)] // TODO: https://github.com/wrpc/wrpc/issues/2

use core::fmt::{self, Display};
use core::future::Future;
use core::iter::zip;
use core::ops::{BitOrAssign, Shl};
Expand All @@ -18,8 +17,11 @@ use tokio::try_join;
use tokio_util::codec::Encoder;
use tracing::{error, trace};
use tracing::{instrument, warn};
use wasm_tokio::cm::{AsyncReadValue as _, CharEncoder};
use wasm_tokio::{AsyncReadCore as _, CoreStringEncoder, Leb128Encoder};
use wasm_tokio::cm::AsyncReadValue as _;
use wasm_tokio::{
AsyncReadCore as _, AsyncReadLeb128 as _, AsyncReadUtf8 as _, CoreStringEncoder, Leb128Encoder,
Utf8Encoder,
};
use wasmtime::component::types::{self, Case, Field};
use wasmtime::component::{Linker, ResourceType, Type, Val};
use wasmtime::{AsContextMut, StoreContextMut};
Expand Down Expand Up @@ -168,7 +170,7 @@ where
Ok(())
}
(Val::Char(v), Type::Char) => {
CharEncoder.encode(*v, dst).context("failed to encode char")
Utf8Encoder.encode(*v, dst).context("failed to encode char")
}
(Val::String(v), Type::String) => CoreStringEncoder
.encode(v.as_str(), dst)
Expand Down Expand Up @@ -582,7 +584,7 @@ where
Ok(())
}
Type::Char => {
let v = r.read_char().await?;
let v = r.read_char_utf8().await?;
*val = Val::Char(v);
Ok(())
}
Expand Down

0 comments on commit 86d06a4

Please sign in to comment.