Crate ptr_meta[][src]

Expand description

A radioactive stabilization of the ptr_meta RFC.


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;

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
trait Stringy {
    fn as_string(&self) -> String;


The metadata for a Dyn = dyn SomeTrait trait object type.


Extension methods for NonNull.

Provides the pointer metadata type of any pointed-to type.

Extension methods for pointers.


Forms a (possibly-wide) raw pointer from a data address and metadata.

Performs the same functionality as from_raw_parts, except that a raw *mut pointer is returned, as opposed to a raw *const pointer.

Extract the metadata component of a pointer.

Attribute Macros

Generates an implementation of Pointee for trait objects.

Derive Macros

Generates an implementation of Pointee for structs with a DST as its last field.