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

Improve type ergonomics and add Error type #82

Merged
merged 7 commits into from
May 1, 2020

Conversation

ebkalderon
Copy link
Owner

Added

  • Add common Error type to use throughout the library.

Changed

  • Return PathBuf from get_capture() instead of String.
  • Return &Path from get_{log,capture}_file_path_template() instead of &str.
  • Accept Into<PathBuf> or Into<String> in some places to avoid extra allocation if possible.
  • Document if path argument is None in docs for set_capture_file_comments().
  • Switch from lazy_static to once_cell.

These changes were long overdue, and this crate hasn't seen any love in years. It's time to change that!

The `OnceCell::get_or_try_init()` method will help use construct a
common error type to use throughout our library. With `lazy_static`, we
would be stuck with a borrowed version of the resulting error instead of
an owned value, meaning we cannot `?` or store it anywhere without a
lifetime.
@ebkalderon ebkalderon self-assigned this May 1, 2020
@ebkalderon ebkalderon merged commit f77ab39 into master May 1, 2020
@ebkalderon ebkalderon deleted the improve-type-ergonomics branch May 1, 2020 11:14
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.

1 participant