[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgj49zs2=O-e3h=VqkRDDzhozvV6p=-5AKN_Q9-caT++cQ@mail.gmail.com>
Date: Fri, 3 May 2024 16:36:02 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...sung.com>, Marco Elver <elver@...gle.com>,
Kees Cook <keescook@...omium.org>, Coly Li <colyli@...e.de>, Paolo Abeni <pabeni@...hat.com>,
Pierre Gondois <pierre.gondois@....com>, Ingo Molnar <mingo@...nel.org>,
Jakub Kicinski <kuba@...nel.org>, Wei Yang <richard.weiyang@...il.com>,
Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 1/9] rust: list: add ListArc
On Thu, Apr 4, 2024 at 4:00 PM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> On Wed, Apr 3, 2024 at 5:51 PM Benno Lossin <benno.lossin@...ton.me> wrote:
> >
> > On 02.04.24 14:16, Alice Ryhl wrote:
> > > +impl<T: ListArcSafe<ID>, const ID: u64> ListArc<T, ID> {
> > > + /// Constructs a new reference counted instance of `T`.
> > > + pub fn try_new(contents: T) -> Result<Self, AllocError> {
> > > + Ok(Self::from_unique(UniqueArc::try_new(contents)?))
> > > + }
> > > +
> > > + /// Use the given initializer to in-place initialize a `T`.
> > > + ///
> > > + /// If `T: !Unpin` it will not be able to move afterwards.
> > > + pub fn pin_init<E>(init: impl PinInit<T, E>) -> error::Result<Self>
> > > + where
> > > + Error: From<E>,
> > > + {
> > > + Ok(Self::from_pin_unique(UniqueArc::pin_init(init)?))
> > > + }
> >
> > pin-init has a general trait for this: InPlaceInit. I don't know if the
> > other functions that it provides would help you.
>
> I will use that.
Turns out it's not possible to use the trait in this case, for the
same reasons as why Arc isn't using them either.
Alice
Powered by blists - more mailing lists