mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cut: Make Write
arguments generic instead of dyn
We pass a `&mut dyn Write` in anyway, but now that's entirely up to the caller.
This commit is contained in:
parent
a9cd3f132e
commit
1a7759586a
1 changed files with 10 additions and 10 deletions
|
@ -70,9 +70,9 @@ fn list_to_ranges(list: &str, complement: bool) -> Result<Vec<Range>, String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cut_bytes<R: Read>(
|
fn cut_bytes<R: Read, W: Write>(
|
||||||
reader: R,
|
reader: R,
|
||||||
out: &mut dyn Write,
|
out: &mut W,
|
||||||
ranges: &[Range],
|
ranges: &[Range],
|
||||||
opts: &Options,
|
opts: &Options,
|
||||||
) -> UResult<()> {
|
) -> UResult<()> {
|
||||||
|
@ -108,9 +108,9 @@ fn cut_bytes<R: Read>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output delimiter is explicitly specified
|
// Output delimiter is explicitly specified
|
||||||
fn cut_fields_explicit_out_delim<R: Read, M: Matcher>(
|
fn cut_fields_explicit_out_delim<R: Read, W: Write, M: Matcher>(
|
||||||
reader: R,
|
reader: R,
|
||||||
out: &mut dyn Write,
|
out: &mut W,
|
||||||
matcher: &M,
|
matcher: &M,
|
||||||
ranges: &[Range],
|
ranges: &[Range],
|
||||||
only_delimited: bool,
|
only_delimited: bool,
|
||||||
|
@ -193,9 +193,9 @@ fn cut_fields_explicit_out_delim<R: Read, M: Matcher>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output delimiter is the same as input delimiter
|
// Output delimiter is the same as input delimiter
|
||||||
fn cut_fields_implicit_out_delim<R: Read, M: Matcher>(
|
fn cut_fields_implicit_out_delim<R: Read, W: Write, M: Matcher>(
|
||||||
reader: R,
|
reader: R,
|
||||||
out: &mut dyn Write,
|
out: &mut W,
|
||||||
matcher: &M,
|
matcher: &M,
|
||||||
ranges: &[Range],
|
ranges: &[Range],
|
||||||
only_delimited: bool,
|
only_delimited: bool,
|
||||||
|
@ -264,9 +264,9 @@ fn cut_fields_implicit_out_delim<R: Read, M: Matcher>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// The input delimiter is identical to `newline_char`
|
// The input delimiter is identical to `newline_char`
|
||||||
fn cut_fields_newline_char_delim<R: Read>(
|
fn cut_fields_newline_char_delim<R: Read, W: Write>(
|
||||||
reader: R,
|
reader: R,
|
||||||
out: &mut dyn Write,
|
out: &mut W,
|
||||||
ranges: &[Range],
|
ranges: &[Range],
|
||||||
newline_char: u8,
|
newline_char: u8,
|
||||||
out_delim: &[u8],
|
out_delim: &[u8],
|
||||||
|
@ -295,9 +295,9 @@ fn cut_fields_newline_char_delim<R: Read>(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cut_fields<R: Read>(
|
fn cut_fields<R: Read, W: Write>(
|
||||||
reader: R,
|
reader: R,
|
||||||
out: &mut dyn Write,
|
out: &mut W,
|
||||||
ranges: &[Range],
|
ranges: &[Range],
|
||||||
opts: &Options,
|
opts: &Options,
|
||||||
) -> UResult<()> {
|
) -> UResult<()> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue