Checkpoint for gRPC implementation

This commit is contained in:
2026-05-12 13:44:53 -07:00
parent 02a0b0d908
commit 804ff3ead0
12 changed files with 882 additions and 19 deletions
+4 -3
View File
@@ -439,14 +439,15 @@ fn write_message(msg_proto: &DescriptorProto, output: &mut String) {
output.push_str("}\n\n");
output.push_str(&format!("impl roto_runtime::RotoOwned for Owned{} {{\n", msg_name));
output.push_str(&format!(" type Reader<'a> = {}<'a>;\n", msg_name));
output.push_str(&format!(" fn reader(&self) -> {}<'_> {{\n", msg_name));
output.push_str(&format!(" {}::new(&self.data).expect(\"failed to create reader\")\n", msg_name));
output.push_str(" }\n");
output.push_str("}\n\n");
output.push_str(&format!("impl roto_runtime::RotoMessage for Owned{} {{\n", msg_name));
output.push_str(" fn decode(buf: bytes::Bytes) -> Self {\n");
output.push_str(&format!(" Owned{} {{ data: buf }}\n", msg_name));
output.push_str(" fn decode(buf: bytes::Bytes) -> roto_runtime::Result<Self> {\n");
output.push_str(&format!(" Ok(Owned{} {{ data: buf }})\n", msg_name));
output.push_str(" }\n\n");
output.push_str(" fn bytes(&self) -> bytes::Bytes {\n");
output.push_str(" self.data.clone()\n");
@@ -675,7 +676,7 @@ fn write_service(svc_proto: &ServiceDescriptorProto, output: &mut String) {
};
output.push_str(&format!(
" async fn {}(&self, request: {}) -> Result<{}, Status>;\n",
" async fn {}(&self, request: {}) -> std::result::Result<{}, Status>;\n",
method_name, req_type, resp_type
));
}