Skip to content

Commit

Permalink
split: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhitkoff committed Oct 17, 2023
1 parent b889e52 commit aeaf39d
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/uu/split/src/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ fn custom_write<T: Write>(
}

/// Custom wrapper for `write_all()` method
/// Similar to * [`custom_write`], but returns true or false
/// Similar to [`custom_write`], but returns true or false
/// depending on if `--filter` stdin is still open (no BrokenPipe error)
/// Should not be used for Kth chunk number sub-strategies
/// as those do not work with `--filter` option
Expand Down Expand Up @@ -996,6 +996,7 @@ impl<'a> ByteChunkWriter<'a> {
}

impl<'a> Write for ByteChunkWriter<'a> {
/// Implements `--bytes=SIZE`
fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
// If the length of `buf` exceeds the number of bytes remaining
// in the current chunk, we will need to write to multiple
Expand Down Expand Up @@ -1125,6 +1126,7 @@ impl<'a> LineChunkWriter<'a> {
}

impl<'a> Write for LineChunkWriter<'a> {
/// Implements `--lines=NUMBER`
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
// If the number of lines in `buf` exceeds the number of lines
// remaining in the current chunk, we will need to write to
Expand Down Expand Up @@ -1259,6 +1261,8 @@ impl<'a> Write for LineBytesChunkWriter<'a> {
/// |------| |-------| |--------| |---|

Check failure on line 1261 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1261; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1261 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1261; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// aaaaaaaa a\nbbbb\n cccc\ndd\n ee\n
/// ```
///
/// Implements `--line-bytes=SIZE`
fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
// The total number of bytes written during the loop below.
//
Expand Down Expand Up @@ -1387,6 +1391,10 @@ impl<'a> Write for LineBytesChunkWriter<'a> {
///

Check failure on line 1391 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1391; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1391 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1391; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// This function returns an error if there is a problem reading from
/// `reader` or writing to one of the output files.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * N
fn split_into_n_chunks_by_byte<R>(
settings: &Settings,
reader: &mut R,
Expand Down Expand Up @@ -1484,6 +1492,10 @@ where
///

Check failure on line 1492 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1492; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1492 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1492; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// This function returns an error if there is a problem reading from
/// `reader` or writing to stdout.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * K/N
fn kth_chunks_by_byte<R>(
settings: &Settings,
reader: &mut R,
Expand Down Expand Up @@ -1577,6 +1589,10 @@ where
///

Check failure on line 1589 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1589; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1589 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1589; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// * [`kth_chunk_by_line`], which splits its input in the same way,
/// but writes only one specified chunk to stdout.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * l/N
fn split_into_n_chunks_by_line<R>(
settings: &Settings,
reader: &mut R,
Expand Down Expand Up @@ -1652,6 +1668,10 @@ where
///

Check failure on line 1668 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1668; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1668 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1668; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// * [`split_into_n_chunks_by_line`], which splits its input in the
/// same way, but writes each chunk to its own file.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * l/K/N
fn kth_chunk_by_line<R>(
settings: &Settings,
reader: &mut R,
Expand Down Expand Up @@ -1718,6 +1738,10 @@ where
///

Check failure on line 1738 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1738; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1738 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1738; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// * [`split_into_n_chunks_by_line`], which splits its input in the same way,
/// but without round robin distribution.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * r/N
fn split_into_n_chunks_by_line_round_robin<R>(
settings: &Settings,
reader: &mut R,
Expand Down Expand Up @@ -1787,6 +1811,10 @@ where
///

Check failure on line 1811 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style/format (ubuntu-latest, feat_os_unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1811; use `cargo fmt -- "src/uu/split/src/split.rs"`)

Check failure on line 1811 in src/uu/split/src/split.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (macos-12, unix)

ERROR: `cargo fmt`: style violation (file:'src/uu/split/src/split.rs', line:1811; use `cargo fmt -- "src/uu/split/src/split.rs"`)
/// * [`split_into_n_chunks_by_line_round_robin`], which splits its input in the
/// same way, but writes each chunk to its own file.
///
/// Implements `--number=CHUNKS`
/// Where CHUNKS
/// * r/K/N
fn kth_chunk_by_line_round_robin<R>(
settings: &Settings,
reader: &mut R,
Expand Down

0 comments on commit aeaf39d

Please sign in to comment.