Rust declarative macro question

How to create a declarative macro that turns the call below into result below..

The actual meta are not important just imagine any N number of meta's that need to be passed
Turn

    tuple_struct_with_attrs!(
        MyTupleStruct;
        #[derive(Debug)],
        #[serde(from = "f64")]
    );

into

#[derive(Debug)],
#[serde(from = "f64")]
struct Tuplestruct{
    f6
);

What is the question?

how to create a delarative macro that turns code above into code below

It is not clear to me what rules your macro should follow to create the tuple struct. Like, what fields should the resulting struct have? Is it always just one f64? A naive macro that produces the output from your example would be:

macro_rules! tuple_struct_with_attrs {
    ($name: ident ; $(#[$attribute: meta]),*) => {
        $(#[$attribute])*
        struct $name ( f64 );
    }
}

Playground.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.