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

Unified Diff: mojo/public/rust/src/bindings/macros.rs

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
« no previous file with comments | « no previous file | mojo/public/rust/src/bindings/message.rs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/rust/src/bindings/macros.rs
diff --git a/mojo/public/rust/src/bindings/macros.rs b/mojo/public/rust/src/bindings/macros.rs
index 49fb05a39af89352a285f9f6c7103081ae98e72e..76e81b812aadb0ad6d548f91a890c68b1a837ad7 100644
--- a/mojo/public/rust/src/bindings/macros.rs
+++ b/mojo/public/rust/src/bindings/macros.rs
@@ -113,18 +113,19 @@ macro_rules! impl_encodable_for_interface {
0 // Indicates that this type is inlined and it adds nothing external to the size
}
fn encode(self, encoder: &mut $crate::bindings::encoding::Encoder, context: $crate::bindings::encoding::Context) {
+ let version = self.version();
let pos = encoder.add_handle(self.as_untyped());
let mut state = encoder.get_mut(&context);
state.encode(pos as i32);
- state.encode(Self::version() as u32);
+ state.encode(version as u32);
}
fn decode(decoder: &mut $crate::bindings::decoding::Decoder, context: $crate::bindings::encoding::Context) -> Result<Self, ValidationError> {
- let (handle_index, _version) = {
+ let (handle_index, version) = {
let mut state = decoder.get_mut(&context);
(state.decode::<i32>(), state.decode::<u32>())
};
let handle = try!(decoder.claim_handle::<$crate::system::message_pipe::MessageEndpoint>(handle_index));
- Ok(Self::new(handle))
+ Ok(Self::with_version(handle, version))
}
}
}
« no previous file with comments | « no previous file | mojo/public/rust/src/bindings/message.rs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698