diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a197d6..70eb080 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ workflows: # get a nightly or stable toolchain via rustup instead of a mutable docker tag toolchain_override: [ '__msrv__', # won't add any other toolchains, just uses what's in the docker image - '1.63.0', # minimum needed to build dev-dependencies + '1.65.0', # minimum needed to build dev-dependencies 'stable', 'beta', 'nightly' diff --git a/Cargo.toml b/Cargo.toml index d7f1d76..4bb27e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["base64", "utf8", "encode", "decode", "no_std"] categories = ["encoding"] license = "MIT OR Apache-2.0" edition = "2018" -# dev-dependencies require 1.63, but the main code doesn't +# dev-dependencies require 1.65, but the main code doesn't # This option was added in 1.56, keep it for when we bump MSRV. rust-version = "1.48.0" diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index dcd7d30..d6d94c5 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,7 @@ +# 0.21.5 + +- Add `Debug` and `Clone` impls for the general purpose Engine + # 0.21.4 - Make `encoded_len` `const`, allowing the creation of arrays sized to encode compile-time-known data lengths diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 61d542f..802c8cc 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -39,8 +39,7 @@ fn do_decode_bench_slice(b: &mut Bencher, &size: &usize) { fill(&mut v); let encoded = STANDARD.encode(&v); - let mut buf = Vec::new(); - buf.resize(size, 0); + let mut buf = vec![0; size]; b.iter(|| { STANDARD.decode_slice(&encoded, &mut buf).unwrap(); black_box(&buf); @@ -52,8 +51,7 @@ fn do_decode_bench_stream(b: &mut Bencher, &size: &usize) { fill(&mut v); let encoded = STANDARD.encode(&v); - let mut buf = Vec::new(); - buf.resize(size, 0); + let mut buf = vec![0; size]; buf.truncate(0); b.iter(|| { @@ -96,9 +94,8 @@ fn do_encode_bench_reuse_buf(b: &mut Bencher, &size: &usize) { fn do_encode_bench_slice(b: &mut Bencher, &size: &usize) { let mut v: Vec = Vec::with_capacity(size); fill(&mut v); - let mut buf = Vec::new(); // conservative estimate of encoded size - buf.resize(v.len() * 2, 0); + let mut buf = vec![0; v.len() * 2]; b.iter(|| STANDARD.encode_slice(&v, &mut buf).unwrap()); } diff --git a/src/engine/general_purpose/mod.rs b/src/engine/general_purpose/mod.rs index 01d2204..e0227f3 100644 --- a/src/engine/general_purpose/mod.rs +++ b/src/engine/general_purpose/mod.rs @@ -19,6 +19,8 @@ pub(crate) const INVALID_VALUE: u8 = 255; /// - It uses no vector CPU instructions, so it will work on any system. /// - It is reasonably fast (~2-3GiB/s). /// - It is not constant-time, though, so it is vulnerable to timing side-channel attacks. For loading cryptographic keys, etc, it is suggested to use the forthcoming constant-time implementation. + +#[derive(Debug, Clone)] pub struct GeneralPurpose { encode_table: [u8; 64], decode_table: [u8; 256], diff --git a/src/read/decoder_tests.rs b/src/read/decoder_tests.rs index 625a07d..099dd63 100644 --- a/src/read/decoder_tests.rs +++ b/src/read/decoder_tests.rs @@ -76,7 +76,7 @@ fn trailing_junk() { saw_error = true; break; } - Ok(read) if read == 0 => break, + Ok(0) => break, Ok(_) => (), } }