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

Can't specify a default for a string reference attribute #8

Open
Nemo157 opened this issue Apr 30, 2017 · 0 comments
Open

Can't specify a default for a string reference attribute #8

Nemo157 opened this issue Apr 30, 2017 · 0 comments
Labels
Milestone

Comments

@Nemo157
Copy link
Owner

Nemo157 commented Apr 30, 2017

#[derive(PromAttire)]
struct Attributes<'a> {
    #[attire(default = "bar")]
    foo: &'a str,
}

Defaults use FromStr only, so you get errors like

error[E0277]: the trait bound `str: std::str::FromStr` is not satisfied                                                                                                    --> <anon>:9:10
  |
9 | #[derive(PromAttire)]
  |          ^^^^^^^^^^ the trait `std::str::FromStr` is not implemented for `str`

Probably need to use something like prom_attire_impl::expand::match_parse for parsing the provided default.

@Nemo157 Nemo157 added the bug label Apr 30, 2017
@Nemo157 Nemo157 added this to the 0.1.1 milestone Apr 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant