[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DC5K4M9BQORO.1P8RCL0R7350D@kernel.org>
Date: Mon, 18 Aug 2025 14:37:15 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: <akpm@...ux-foundation.org>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
<bjorn3_gh@...tonmail.com>, <lossin@...nel.org>, <a.hindborg@...nel.org>,
<tmgross@...ch.edu>, <abdiel.janulgue@...il.com>, <acourbot@...dia.com>,
<jgg@...pe.ca>, <lyude@...hat.com>, <robin.murphy@....com>,
<daniel.almeida@...labora.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] rust: scatterlist: Add type-state abstraction for
sg_table
On Mon Aug 18, 2025 at 2:27 PM CEST, Alice Ryhl wrote:
> On Mon, Aug 18, 2025 at 01:16:55PM +0200, Danilo Krummrich wrote:
>> On Mon Aug 18, 2025 at 11:52 AM CEST, Alice Ryhl wrote:
>> > On Fri, Aug 15, 2025 at 07:10:03PM +0200, Danilo Krummrich wrote:
>> >> +{
>> >> + fn new(
>> >> + dev: &Device<Bound>,
>> >> + mut pages: P,
>> >> + dir: dma::DataDirection,
>> >> + flags: alloc::Flags,
>> >> + ) -> Result<impl PinInit<Self, Error> + use<'_, P>> {
>> >
>> > We would probably want to move the logic into the initializer so that we
>> > don't have the double Result here.
>>
>> That'd be nice, but I think it's not possible.
>>
>> We can't borrow from pages in the initializer closure while at the same time
>> store pages with another initializer, can we?
>>
>> Either way, it's not that big a deal I think, since this constructor is not
>> exposed to the outside world. Which is also why it didn't bother me too much.
>
> Ok. Shrug.
I mean, don't get me wrong, if you see a way to avoid the double Result, I'm
happy to change it.
(What I meant is, given the above, I thought it's not possible. But at the same
time I did not spend too much brain cycles, since the constructor is private
anyways.)
Powered by blists - more mailing lists