Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: read config toml file #7
feat: read config toml file #7
Changes from 4 commits
34663c4
e735187
5e9ec05
65c8aa1
461d008
44cdb05
86f491f
2625173
8fc4786
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Believe is better have as u16 instead of Option. To avoid additional unwrap when using the configuration struct later. Since all properties should have a default we can unwrap it on the new.
Also will be good to have a default in the impl. E.g: https://doc.rust-lang.org/std/default/trait.Default.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have started the implementation here
I couldn't come with a solution for when the
user
have the config file, but didn't pass one of the parameters.Because if I set the struct as below:
Now the problem is that when we parse, as the
user
did not specifiedperformance
, it isNone
,Did you have something in mind?
obs: the code can be not that rusty, still learning some patterns, if you think something can improve, just let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries at all @1garo, you are doing a great job. Usually when you're wrapping and come as None, you can use
unwrap_or_else(||
to return the default. Let me know if you still have questions, we can book a day and do this part together 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds great, if you can talk today or tomorrow, just say where I can reach out to you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have telegram, just drop me a message on same username as GH. I also have discord just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think discord is easier for me, I used telegram once in my life. 1garo#7086