1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-02 19:32:25 +01:00

Add *_with_name methods

This commit is contained in:
sharkdp
2020-04-22 22:41:25 +02:00
committed by David Peter
parent 53a973e9dd
commit 261a7ea154
5 changed files with 37 additions and 13 deletions

View File

@@ -82,8 +82,9 @@ impl<'a> Input<'a> {
}
}
pub fn set_provided_name(&mut self, provided_name: Option<&OsStr>) {
pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
self.metadata.user_provided_name = provided_name.map(|n| n.to_owned());
self
}
pub(crate) fn open<R: BufRead + 'a>(self, stdin: R) -> Result<OpenedInput<'a>> {