#ptr #meta

no-std ptr_meta

A radioactive stabilization of the ptr_meta rfc

7 releases

0.3.0-pre1 Nov 4, 2023
0.2.0 Aug 10, 2022
0.1.4 Jul 9, 2021
0.1.3 May 16, 2021
0.1.1 Feb 19, 2021

#17 in No standard library

Download history 188693/week @ 2023-11-03 190787/week @ 2023-11-10 194174/week @ 2023-11-17 191896/week @ 2023-11-24 203822/week @ 2023-12-01 213581/week @ 2023-12-08 215224/week @ 2023-12-15 142605/week @ 2023-12-22 173233/week @ 2023-12-29 225477/week @ 2024-01-05 234385/week @ 2024-01-12 266816/week @ 2024-01-19 280579/week @ 2024-01-26 280400/week @ 2024-02-02 285626/week @ 2024-02-09 210904/week @ 2024-02-16

1,102,266 downloads per month
Used in 486 crates (11 directly)

MIT license

313 lines

ptr_meta   Latest Version License

A radioactive stabilization of the ptr_meta RFC.


Sized types

All Sized types have Pointee implemented for them with a blanket implementation. You do not need to derive Pointee for these types.

slices and strs

These core types have implementations provided.

CStr and OsStr

These std types have implementations provided when the std feature is enabled.

dyn Any and dyn Error

These trait objects have implementations provided.

Structs with a DST as its last field

You can derive Pointee for structs with a trailing DST:

use ptr_meta::Pointee;

struct Block<H, T> {
    header: H,
    elements: [T],

Note that this will only work when the last field is guaranteed to be a DST. Structs with a generic last field may have a conflicting blanket impl since the generic type may be Sized. In these cases, a collection of specific implementations may be required with the generic parameter set to a slice, str, or specific trait object.

Trait objects

You can generate a Pointee implementation for trait objects:

use ptr_meta::pointee;

// Generates Pointee for dyn Stringy
trait Stringy {
    fn as_string(&self) -> String;


~19K SLoC