A box that stores types like pointers, forgetting everything besides Self: Unsize<dyn Trait>

Basic Usage

```rust use dyn_ptr::{Dyn, PointerLike};

fn impl(: impl fmt::Display) {} fn dyn_(x: Dyn) { /* sizeof(x) == (ptr + metadata) */ }

impl(12); impl(12usize); impl(Box::new(12));

dyn((&12).dodyn()); // ref to i32 is repr as PtrRepr dyn(12usize.dodyn()); // usize is repr as PtrRepr dyn(Box::new(12).do_dyn()); // usize is repr as PtrRepr `` Instead ofconst dynandmut dynfat pointers, that fat pointer store dtor and works likeBox`.\ And accept by value (instead of ref/ptr)

This can be used for example in async traits, in which you cannot use Box<dyn Future>, because core has no allocators. Dyn can help erase type about store (for example Pin<Box>) ``rust // possible desugared forasync fn in dyn traits trait Async<'a> { // original:async asyncfn() -> &'a ();` fn asyncfn>() -> C::ImplFuture { // one of possible implementation: todo!(/* async { &() } */) } }

// select: dyn or impl context struct DynCtx; struct ImplCtx;

trait Ctx<'a> { type ImplFuture: Future

fn do_future() -> Self::ImplFuture;

}

impl<'a> Ctx<'a> for DynCtx { type ImplFuture = Dyn;

fn do_future() -> Self::ImplFuture {
    Box::pin(async { &() }).do_dyn()
}

}

impl<'a> Ctx<'a> for ImplCtx { type ImplFuture = impl Future

fn do_future() -> Self::ImplFuture {
    async { &() }
}

}

```

Features

By default, unstable generic_const_exprs is enabled. It is supported in the first place. The default version lags behind