commit | cbf193c01a71fa1a39e4da5024ba86e844675fd4 | [log] [tgz] |
---|---|---|
author | Nikolina Ilic <[email protected]> | Tue Nov 19 12:31:49 2024 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Nov 19 12:31:49 2024 +0000 |
tree | b61d95ec9886160da286dc347580a37fa35c0f2b | |
parent | dd18921148681def463532cdbdbcde3890531a3d [diff] | |
parent | 8cedf65b8263f7addcb996b062a6cac59e1f411c [diff] |
ptr_meta: Add no_std variant am: 8cedf65b82 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/ptr_meta/+/3361366 Change-Id: I56241504115960a4c83a3f10bd6f33fe00585880 Signed-off-by: Automerger Merge Worker <[email protected]>
A radioactive stabilization of the ptr_meta
RFC.
Sized types already have Pointee
implemented for them, so most of the time you won't have to worry about them. However, trying to derive Pointee
for a struct that may or may not have a DST as its last field will cause an implementation conflict with the automatic sized implementation.
slice
s and str
sThese core types have implementations built in.
You can derive Pointee
for last-field DSTs:
use ptr_meta::Pointee; #[derive(Pointee)] struct Block<H, T> { header: H, elements: [T], }
You can generate a Pointee
for trait objects:
use ptr_meta::pointee; // Generates Pointee for dyn Stringy #[pointee] trait Stringy { fn as_string(&self) -> String; }