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

Modify configuration to have provider-specific structs #114

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

anta5010
Copy link
Collaborator

@anta5010 anta5010 commented Feb 26, 2020

Use Enums of structs with provider specific options instead of a common struct.

Checks for missing parameters are not required in get_provider any more because it's done while parsing the config file into enums.

This change covers #70 and #103

Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
@hug-dev hug-dev requested review from hug-dev and ionut-arm February 26, 2020 17:33
@hug-dev hug-dev added the enhancement New feature or request label Feb 26, 2020
Copy link
Member

@hug-dev hug-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent changes! A few things I particularly like:

  • very good and original idea to use a enum composed of struct
  • removing the Option makes the code much more simple
  • I did not even know that you could ignore some fields when matching a enum of structs 💥

Just a small comment about the serde attribute

src/providers/mod.rs Show resolved Hide resolved
src/utils/service_builder.rs Show resolved Hide resolved
Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

src/providers/mod.rs Show resolved Hide resolved
src/providers/mod.rs Outdated Show resolved Hide resolved
Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
Copy link
Member

@hug-dev hug-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Just for future reference: for dealing with review comments you can also amend your commit and force-push it again.

Comment on lines +30 to +33
// For providers configs in parsec config.toml we use a format similar
// to the one described in the Internally Tagged Enum representation
// where "provider_type" is the tag field. For details see:
// https://serde.rs/enum-representations.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great explanation, thank you!

@ionut-arm ionut-arm merged commit 0979b21 into parallaxsecond:master Feb 27, 2020
@anta5010 anta5010 deleted the parsec-70 branch February 27, 2020 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants