diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 8a3e85f..287eb7b 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "weld-codegen" -version = "0.3.2" +version = "0.3.3" edition = "2021" authors = [ "wasmcloud Team" ] license = "Apache-2.0" diff --git a/codegen/src/decode_rust.rs b/codegen/src/decode_rust.rs index 5100ca0..c21a6cb 100644 --- a/codegen/src/decode_rust.rs +++ b/codegen/src/decode_rust.rs @@ -64,7 +64,7 @@ fn decode_double() -> &'static str { "d.f64()?" } fn decode_timestamp() -> &'static str { - todo!(); // tag timestamp + "wasmbus_rpc::Timestamp{ sec: d.i64()?, nsec: d.u32()? }" } fn decode_big_integer() -> &'static str { todo!(); // tag big int diff --git a/codegen/src/encode_rust.rs b/codegen/src/encode_rust.rs index e44712c..2342a9e 100644 --- a/codegen/src/encode_rust.rs +++ b/codegen/src/encode_rust.rs @@ -108,8 +108,12 @@ fn encode_double(val: ValExpr) -> String { fn encode_document(val: ValExpr) -> String { format!("e.bytes({})?;\n", val.as_ref()) } -fn encode_timestamp(_val: ValExpr) -> String { - todo!(); // tag timestamp +fn encode_timestamp(val: ValExpr) -> String { + format!( + "e.i64({}.sec)?;\ne.u32({}.nsec)?;\n", + val.as_str(), + val.as_str() + ) } fn encode_big_integer(_val: ValExpr) -> String { todo!(); // tag big int diff --git a/rpc-rs/src/error.rs b/rpc-rs/src/error.rs index f3f2059..cb635d5 100644 --- a/rpc-rs/src/error.rs +++ b/rpc-rs/src/error.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; /// An error that can occur in the processing of an RPC. This is not request-specific errors but /// rather cross-cutting errors that can always occur. -#[derive(thiserror::Error, Debug, Serialize, Deserialize)] +#[derive(thiserror::Error, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub enum RpcError { /// The request exceeded its deadline.