Re: [PATCH 2/4] rust: add pinned wrapper of Vec
From: Alice Ryhl
Date: Thu Oct 09 2025 - 07:24:05 EST
On Wed, Oct 08, 2025 at 06:10:45PM +0000, Markus Probst wrote:
> Implement a wrapper of Vec that guarantees that its content will never be
> moved, unless the item implements Unpin, allowing PinInit to be
> initialized on the Vec.
> +/// A pinned wrapper of the [`Vec`] type.
> +///
> +/// It is guaranteed that the contents will never be moved, unless T implements Unpin.
> +pub struct PinnedVec<T, A: Allocator>(Vec<T, A>);
Could we simply use `Pin<Vec<T>>` for this purpose? Why the new struct?
In fact, does the utility added by commit ac9eea3d08c2 ("rust: alloc:
implement Box::pin_slice()") not satisfy your needs?
Also, this thread seems mangled. Patches 2, 3, and 4 should all be
replies to patch 1. Right now the thread is deeply nested.
Alice