From 2f823d59b05b49f3286948dd8fdda5469dc22b8f Mon Sep 17 00:00:00 2001 From: Ethan P Date: Fri, 15 May 2020 16:18:44 -0700 Subject: [PATCH] Add PrettyPrinter::input function --- CHANGELOG.md | 1 + src/pretty_printer.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2aae384..da9b9346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - `PrettyPrinter::vcs_modification_markers` has been marked deprecated when building without the `git` feature, see #997 and #1020 (@eth-p, @sharkdp) - Add APIs to provide `Input` descriptions with `InputDescription` (@eth-p) +- Add function to directly provide `Input`s to `PrettyPrinter` (@eth-p) ## Packaging diff --git a/src/pretty_printer.rs b/src/pretty_printer.rs index ccbe72dd..6dedf8a4 100644 --- a/src/pretty_printer.rs +++ b/src/pretty_printer.rs @@ -55,6 +55,12 @@ impl<'a> PrettyPrinter<'a> { } } + /// Add an input which should be pretty-printed + pub fn input(&mut self, input: Input<'a>) -> &mut Self { + self.inputs.push(input); + self + } + /// Add a file which should be pretty-printed pub fn input_file(&mut self, path: impl AsRef) -> &mut Self { self.inputs.push(Input::ordinary_file(path.as_ref()));