[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALNs47v3cE-_LiJBTg0_Zkh_cinktHHP3xJ3tL3PAHn5+NBNCA@mail.gmail.com>
Date: Sun, 8 Oct 2023 02:19:46 -0400
From: Trevor Gross <tmgross@...ch.edu>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: netdev@...r.kernel.org, rust-for-linux@...r.kernel.org, andrew@...n.ch,
miguel.ojeda.sandonis@...il.com, greg@...ah.com
Subject: Re: [PATCH v2 1/3] rust: core abstractions for network PHY drivers
On Sat, Oct 7, 2023 at 6:33 PM FUJITA Tomonori
<fujita.tomonori@...il.com> wrote:
> To create an internal type based on `name`, we need to unstringify
> `name`? I can't find a easy way to do it.
I think you should just be able to do it with `paste!`
macro_rules! module_phy_driver {
(name: $name:expr) => {
paste::paste! {
#[allow(non_camel_case_types)]
struct [<$name _ty>];
}
}
}
// creates struct `demo_driver_ty`
module_phy_driver! {
name: "demo_driver"
}
Powered by blists - more mailing lists