Skip to content

Commit

Permalink
subscriber: add MakeWriter combinators (#1274)
Browse files Browse the repository at this point in the history
Depends on #1141.

This branch adds a `MakeWriterExt` trait which adds a number of
combinators for composing multiple types implementing `MakeWriter`.
`MakeWriter`s can now be teed together, filtered with minimum and
maximum levels, filtered with a `Metadata` predicate, and combined with
a fallback for when a writer is _not_ made for a particular `Metadata`.

I've also added a `MakeWriter` impl for `std::fs::File`, because `&File`
implements `Write`. Ideally, we'd have a default impl of `MakeWriter`
for `T where &T: Write`, but that's not possible due to the impl of
`MakeWriter` for `F: Fn() -> T: Write`. We could add a generic `by_ref`
adapter for any `T where &T: Write`, though...

Signed-off-by: Eliza Weisman <[email protected]>
  • Loading branch information
hawkw authored Jun 25, 2021
1 parent 96eaaa0 commit d6298cd
Show file tree
Hide file tree
Showing 2 changed files with 871 additions and 17 deletions.
Loading

0 comments on commit d6298cd

Please sign in to comment.