Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2320)

Unified Diff: mojom/generators/rust/rustgen/source.go

Issue 2240003002: Rust: Polish off communication across Mojom interfaces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Upload newest version of code gen Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojom/generators/rust/rustgen/source.go
diff --git a/mojom/generators/rust/rustgen/source.go b/mojom/generators/rust/rustgen/source.go
index 8a81d47369e208a97541bb9cf5ab91f63e44f5bb..a4769091f86bb5a2b9bad00797853b836cfb0c9c 100644
--- a/mojom/generators/rust/rustgen/source.go
+++ b/mojom/generators/rust/rustgen/source.go
@@ -82,6 +82,11 @@ type EnumTemplate struct {
Signed bool
}
+type EndpointTemplate struct {
+ Name string
+ Interface string
+}
+
type InterfaceMessageTemplate struct {
Name string
// This is the ordinal name (denoted by '@x' in the IDL).
@@ -95,6 +100,8 @@ type InterfaceMessageTemplate struct {
type InterfaceTemplate struct {
Name string
ServiceName string
+ Client EndpointTemplate
+ Server EndpointTemplate
Version uint32
Messages []InterfaceMessageTemplate
Enums []EnumTemplate
@@ -296,6 +303,14 @@ func NewInterfaceTemplate(context *Context, mojomInterface *mojom_types.MojomInt
if mojomInterface.ServiceName != nil {
service_name = *mojomInterface.ServiceName
}
+ client := EndpointTemplate{
+ Name: interface_name + "Client",
+ Interface: interface_name,
+ }
+ server := EndpointTemplate{
+ Name: interface_name + "Server",
+ Interface: interface_name,
+ }
// Generate templates for the containing constants and enums
var constants []ConstantTemplate
@@ -324,10 +339,11 @@ func NewInterfaceTemplate(context *Context, mojomInterface *mojom_types.MojomInt
ResponseStruct: resp_struct,
})
}
-
return InterfaceTemplate{
Name: interface_name,
ServiceName: service_name,
+ Client: client,
+ Server: server,
Version: mojomInterface.CurrentVersion,
Enums: enums,
Constants: constants,

Powered by Google App Engine
This is Rietveld 408576698