ptr_meta: Add no_std variant

The ptr_meta no_std variant will be used for the uefi no_std dependency.
Use cargo_embargo tool to generate the Android.bp file.

cargo_embargo generate cargo_embargo.json

Test: m libptr_meta_nostd
Change-Id: I5469ca484e58ee846ac82d8982553947e3a7d62c
2 files changed
tree: b61d95ec9886160da286dc347580a37fa35c0f2b
  1. src/
  2. Android.bp
  3. Cargo.toml
  4. Cargo.toml.orig
  5. cargo_embargo.json
  6. crates-io.md
  7. LICENSE
  8. METADATA
  9. MODULE_LICENSE_MIT
  10. OWNERS
  11. README.md
README.md

ptr_meta   Latest Version License requires: rustc 1.47+

ptr_meta

A radioactive stabilization of the ptr_meta RFC.

Usage

Sized types

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.

slices and strs

These core types have implementations built in.

Structs with a DST as its last field

You can derive Pointee for last-field DSTs:

use ptr_meta::Pointee;

#[derive(Pointee)]
struct Block<H, T> {
    header: H,
    elements: [T],
}

Trait objects

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;
}