Mercurial > lbo > hg > localmr
changeset 60:c8cab29a9d89
Reorganized formats/lines.rs code
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 05 Feb 2016 22:01:44 +0000 |
parents | 359c981afa71 |
children | bcf1cc002325 |
files | src/formats/lines.rs |
diffstat | 1 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/formats/lines.rs Fri Feb 05 21:48:31 2016 +0000 +++ b/src/formats/lines.rs Fri Feb 05 22:01:44 2016 +0000 @@ -71,20 +71,6 @@ } } -/// An MRSinkGenerator type that uses a simple path as base -/// and creates text files based on it. -pub struct LinesSinkGenerator { - basepath: String, -} - -impl LinesSinkGenerator { - /// Use either a path like `/a/b/c/` to generate files in a directory - /// or `/a/b/c/file_prefix_` to create files with that prefix. - pub fn new(path: &String) -> LinesSinkGenerator { - LinesSinkGenerator { basepath: path.clone() } - } -} - /// Writer that separates the chunks written by '\n' characters. pub struct LinesWriter { file: fs::File, @@ -106,6 +92,20 @@ } } +/// An MRSinkGenerator type that uses a simple path as base +/// and creates text files based on it. +pub struct LinesSinkGenerator { + basepath: String, +} + +impl LinesSinkGenerator { + /// Use either a path like `/a/b/c/` to generate files in a directory + /// or `/a/b/c/file_prefix_` to create files with that prefix. + pub fn new(path: &String) -> LinesSinkGenerator { + LinesSinkGenerator { basepath: path.clone() } + } +} + impl util::MRSinkGenerator for LinesSinkGenerator { type Sink = LinesWriter; fn new_output(&mut self, name: &String) -> Self::Sink { @@ -119,6 +119,7 @@ } } + #[cfg(test)] mod test { use formats::lines;