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

derive(Clone, Debug, Default) #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nandoflorestan
Copy link
Contributor

I am using Param and ParamDef without using the rest of the library (so far).

When I tried to store Params in an array, Rust complained that it couldn't, for lack of one of these basic traits. If one of them is inappropriate, please enlighten this Rust beginner.

@Boscop
Copy link
Owner

Boscop commented Oct 15, 2018

Thanks. I think Clone and Debug make sense to derive but Default doesn't. In which situation do you need it to be Default?
If you have a struct where you derive Default that has a member like Option<Param> or Vec<ParamDef>, I recommend deriving SmartDefault instead, which is smart enough to know that the T doesn't have to be Default (because None and vec![] don't need to instantiate a T).

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

Successfully merging this pull request may close these issues.

2 participants