[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d11857f1-bd9f-4cc5-ab33-44d021315796@proton.me>
Date: Mon, 27 May 2024 09:05:38 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>, mu001999 <mu001999@...look.com>
Cc: ojeda@...nel.org, boqun.feng@...il.com, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: kernel: make impl_has_work compatible with more complex generics
On 22.05.24 14:37, Alice Ryhl wrote:
> On Wed, May 22, 2024 at 2:27 PM mu001999 <mu001999@...look.com> wrote:
>> impl_has_work! {
>> - impl<T> HasWork<Self> for ClosureWork<T> { self.work }
>> + impl{T} HasWork<Self> for ClosureWork<T> { self.work }
>> }
>
> I ended up doing something similar for the generics in some of the
> linked list patches. Does anyone know if it's possible to support this
> without giving up the <T> syntax?
I tried to come up with something some time ago, but it was not really
nice. You have to parse the entire generics manually, which ends up
looking horrible. I have been thinking some time now that a `generics`
fragment would actually be really useful in declarative macros.
I also thought that if we get even more `Has*` traits for intrusive
datastructures, we could add a unified derive macro that allows you to
just do:
#[derive(Intrusive)]
struct MyStruct {
#[intrusive]
work: Work<Self>,
#[intrusive]
timer: Timer<Self>,
/* ... */
}
But I thought that as long as we have only two intrusive structures, we
don't need this.
---
Cheers,
Benno
Powered by blists - more mailing lists