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

Display and From<Schedule> for String #54

Merged
merged 1 commit into from
Jul 28, 2020

Conversation

bittrance
Copy link
Contributor

Support turning a cron::Schedule back into a string as discussed in #46. That issue spoke of a to_string() method, but this PR instead implements From<Schedule> for String, which feels more Rust:y.

The "pure" way to implement this would be to have the nom functions return the full string as well as the parsed result and use that to construct the Schedule objects. However, I felt that would risk complicating future refactoring and instead chose to inject the original representation into the Schedule struct by replacing an option value. A bit more hack:y, but a better separation of concerns, I think.

Copy link
Owner

@zslayton zslayton left a comment

Choose a reason for hiding this comment

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

A bit more hack:y, but a better separation of concerns, I think.

After reading through what the "pure" approach would take, I agree. Thanks for the patch!

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.

None yet

2 participants