Re: [PATCH v4 10/14] rust: alloc: add `Box::into_pin`
From: Danilo Krummrich
Date: Mon Dec 09 2024 - 05:25:49 EST
On Fri, Dec 06, 2024 at 10:25:02PM +0100, Andreas Hindborg wrote:
> "Danilo Krummrich" <dakr@xxxxxxxxxx> writes:
>
> > On Fri, Dec 06, 2024 at 08:33:02PM +0100, Andreas Hindborg wrote:
> >> Add an associated function to convert a `Box<T>` into a `Pin<Box<T>>`.
> >
> > What do you need this function for?
> >
> > There is an `impl<T, A> From<Box<T, A>> for Pin<Box<T, A>>` already.
> >
>
> I didn't realize, but that could work as well. I was rebasing this
> series from before we did our own `Box`, and rust `Box` has this method,
> which I was using.
>
> At any rate, I think it would make sense to have `into_pin` as well as
> the `From` impl, to match the standard library. We could always
> implement one in terms of the other.
I'm not against that -- one of my earlier allocator series actually even had
this function. However, the feedback was to rather not have it at the time.
As mentioned, I'm still fine with including this function though.
Please implement `ìnto_pin` using the existing `From` trait for the next
iteration.
- Danilo
>
>
> Best regards,
> Andreas Hindborg
>
>