Skip to content

Commit d41d51a

Browse files
authored
Merge pull request #6719 from andrewliebenow/basenc-faster-encoding
basenc: perform faster, streaming encoding
2 parents 50f9958 + 32e1c54 commit d41d51a

File tree

15 files changed

+1597
-277
lines changed

15 files changed

+1597
-277
lines changed

Cargo.lock

Lines changed: 81 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/base32/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# spell-checker:ignore proptest
2+
13
[package]
24
name = "uu_base32"
35
version = "0.0.27"
@@ -20,6 +22,9 @@ path = "src/base32.rs"
2022
clap = { workspace = true }
2123
uucore = { workspace = true, features = ["encoding"] }
2224

25+
[dev-dependencies]
26+
proptest = "1.5.0"
27+
2328
[[bin]]
2429
name = "base32"
2530
path = "src/main.rs"

src/uu/base32/src/base32.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,23 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
use std::io::{stdin, Read};
6+
pub mod base_common;
77

88
use clap::Command;
99
use uucore::{encoding::Format, error::UResult, help_about, help_usage};
1010

11-
pub mod base_common;
12-
1311
const ABOUT: &str = help_about!("base32.md");
1412
const USAGE: &str = help_usage!("base32.md");
1513

1614
#[uucore::main]
1715
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
1816
let format = Format::Base32;
1917

20-
let config: base_common::Config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
18+
let config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
2119

22-
// Create a reference to stdin so we can return a locked stdin from
23-
// parse_base_cmd_args
24-
let stdin_raw = stdin();
25-
let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
20+
let mut input = base_common::get_input(&config)?;
2621

27-
base_common::handle_input(
28-
&mut input,
29-
format,
30-
config.wrap_cols,
31-
config.ignore_garbage,
32-
config.decode,
33-
)
22+
base_common::handle_input(&mut input, format, config)
3423
}
3524

3625
pub fn uu_app() -> Command {

0 commit comments

Comments
 (0)