on master help sign in
Add PrettyPrinter::input function
2f823d5Ethan P
CHANGELOG.md+1
@@ -50,6 +50,7 @@
50
50
51- `PrettyPrinter::vcs_modification_markers` has been marked deprecated when building without the `git` feature, see #997 and #1020 (@eth-p, @sharkdp)
51- `PrettyPrinter::vcs_modification_markers` has been marked deprecated when building without the `git` feature, see #997 and #1020 (@eth-p, @sharkdp)
52- Add APIs to provide `Input` descriptions with `InputDescription` (@eth-p)
52- Add APIs to provide `Input` descriptions with `InputDescription` (@eth-p)
53+- Add function to directly provide `Input`s to `PrettyPrinter` (@eth-p)
53
54
54## Packaging
55## Packaging
55
56
src/pretty_printer.rs+6
@@ -55,6 +55,12 @@ impl<'a> PrettyPrinter<'a> {
55 }
55 }
56 }
56 }
57
57
58+ /// Add an input which should be pretty-printed
59+ pub fn input(&mut self, input: Input<'a>) -> &mut Self {
60+ self.inputs.push(input);
61+ self
62+ }
63+
58 /// Add a file which should be pretty-printed
64 /// Add a file which should be pretty-printed
59 pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
65 pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
60 self.inputs.push(Input::ordinary_file(path.as_ref()));
66 self.inputs.push(Input::ordinary_file(path.as_ref()));