Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional positional arguments in tuple structs #20

Closed
musjj opened this issue Apr 13, 2024 · 1 comment
Closed

Optional positional arguments in tuple structs #20

musjj opened this issue Apr 13, 2024 · 1 comment

Comments

@musjj
Copy link

musjj commented Apr 13, 2024

I tried something like this:

#[derive(deluxe::ExtractAttributes)]
#[deluxe(attributes(foobar))]
struct TupleStruct(
    Ident,
    #[deluxe(default)] Option<Ident>,
);

But this requires you to use Some(...) when using the attribute:

#[foobar(hello, Some(world))
numb: f32,

Is there a way so that we can omit the Some?

@musjj
Copy link
Author

musjj commented Apr 13, 2024

It looks like that this works:

#[derive(deluxe::ExtractAttributes)]
#[deluxe(attributes(foobar))]
struct TupleStruct(
    Ident,
    #[deluxe(default, with = deluxe::with::syn)] Option<Ident>,
);

Very cool library 👍

@musjj musjj closed this as completed Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant