commit | c1d44f25b72898905453de662bb7ecc0e64ac41e | [log] [tgz] |
---|---|---|
author | Nikolina Ilic <[email protected]> | Tue Nov 05 18:45:05 2024 +0000 |
committer | Nikolina Ilic <[email protected]> | Mon Nov 11 21:48:52 2024 +0000 |
tree | e3716c104122c3d29575070ad0d924ac9d572e9d | |
parent | c83e70be36108dfe8c1d680cd094caafecdf1423 [diff] |
Third-Party Import of: https://crates.io/crates/ptr_meta/0.2.0 Request Document: go/android3p For CL Reviewers: go/android3p#reviewing-a-cl For Build Team: go/ab-third-party-imports Generated through these steps (in ~src/android/aosp-main-future-without-vendor repo): 1. python3 development/scripts/get_rust_pkg.py -add3prf -v -o /tmp ptr_meta-0.2.0 2. cp -r /tmp/ptr_meta-0.2.0/* external/rust/crates/ptr_meta Test: - Bug: 375626569 Original import of the code can be found at: https://googleplex-android.googlesource.com/platform/external/rust/crates/ptr_meta/+/refs/heads/third-party-review. Security Questionnaire: http://b/375626569#comment1 Change-Id: I433c929328b1863204c12a866ddd414f4f85732d
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; }