Module possibly_uninit::cast[][src]

Helpers for casting between smart pointer types.

This module attempts to abstract casting operations between various smart pointer types as well as non-pointer types. While it succeeds at its goal in some ways, it fails in other ways.

Unfortunately it’s a bunch of unsafe code and it reached the point at which I’m not as confident in its soundness as I would like to be.

Currently it mainly attempts to enable Cursor::try_cast_initialized to work with all kinds of sensible arrays: [T; N], UniqueRefType[T; N], UniqueRefType<[T]> for T and MaybeUninit<T>. It does work for MaybeUninit<T> arrays but not for T arrays. Which isn’t too important right now, but it’d be nice to resolve it.

Traits

ArrTc

Array type constructor

CastArrHelper

A trick to work arround the limitation of Rust where the compiler can’t understand that two impls with different associated types aren’t conflicting.

InitTc

Initialization type constructor

PointerMut

Trait for unique smart pointers/references containing Sized types allowing casting between them.

PtrTc

Type constructor for smart pointer types

SlicePointerMut

Trait for unique smart pointers/references containing slices, allowing casting between them.