subscriber: Add MakeWriter impl for Option #3196
Open
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.
This adds a
MakeWriter
impl forOption<M>
whereM: MakeWriter
.This makes it possible to use
Option<MakeWriter>
in combination withother
MakeWriter
implementations (e.g.Tee
).An example is found in #776,
where depending on the configuration, the user might want to use any or
all of
File
,Stdout
, andStderr
writers.Motivation
I was looking to contribute by trying to close out old PRs and tasks. The current oldest is #776. In that, @SriRamanujam expressed a need where they could combine multiple make writers easily. This is currently tricky as the types would have to be type erased in order for this to work. Making
Option<impl MakeWriter>
implementMakeWriter
simplifies that significantly.Solution
Implement
MakeWriter
forOption<M>
whereM: MakeWriter