commit | 006d319b1118d0b632bd42f80e0be1e8ed736fa7 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Tue Sep 22 00:31:22 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Sep 22 00:31:22 2020 +0000 |
tree | bbabc156c346b1efb85400e76f684c5b795c02c4 | |
parent | 46eb57c424625d9d2cb1b8582046e9fe1191b465 [diff] | |
parent | 4bd07209683a5b9090d61cb6d10861fb9973ec09 [diff] |
Merge "Implement ToOwned for references to AIDL interfaces" am: 4bd0720968 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1395668 Change-Id: I1750afe0c9669b72ea1fc1142bc8e1535a6a5150
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs index ceb6ade..81a5f02 100644 --- a/libs/binder/rust/src/binder.rs +++ b/libs/binder/rust/src/binder.rs
@@ -590,6 +590,15 @@ f.pad(stringify!($interface)) } } + + // Convert a &dyn $interface to Box<dyn $interface> + impl std::borrow::ToOwned for dyn $interface { + type Owned = Box<dyn $interface>; + fn to_owned(&self) -> Self::Owned { + self.as_binder().into_interface() + .expect(concat!("Error cloning interface ", stringify!($interface))) + } + } }; }