Thread (49 messages) 49 messages, 5 authors, 2023-10-09

Re: [PATCH v2 1/3] rust: core abstractions for network PHY drivers

From: Trevor Gross <tmgross@umich.edu>
Date: 2023-10-08 06:19:59
Also in: rust-for-linux

On Sat, Oct 7, 2023 at 6:33 PM FUJITA Tomonori
[off-list ref] 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"
    }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help