8000 Field attribute macro should contain its name · Issue #708 · extendr/extendr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Field attribute macro should contain its name #708

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

Open
CGMossa opened this issue Mar 4, 2024 · 0 comments
Open

Field attribute macro should contain its name #708

CGMossa opened this issue Mar 4, 2024 · 0 comments

Comments

@CGMossa
Copy link
Member
CGMossa commented Mar 4, 2024

Looking at this example snippet

#[extendr(use_try_from = true)]
fn with_optional_input(#[default = "NULL"] idx : Nullable<Integers>) -> Integers {
    match idx {
        NotNull(x) => x,
        Null => (0..5).collect::<Integers>() /* do not remember the syntax */
    }
}

Source: extendr/extendr.github.io#27

Here #[extendr] macro has a field attribute that is not #[extendr(default = "NULL")].
I believe including the macro name in the attribute is standard practice, to avoid collisions with other macros.

See https://serde.rs/field-attrs.html as an example

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
0