Skip to content

Commit efb6c00

Browse files
Release notes
1 parent 2b91084 commit efb6c00

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "base64"
3-
version = "0.21.7"
3+
version = "0.22.0"
44
authors = ["Alice Maz <[email protected]>", "Marshall Pierce <[email protected]>"]
55
description = "encodes and decodes base64 as bytes or utf8"
66
repository = "https://github.com/marshallpierce/rust-base64"

RELEASE-NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.22.0
2+
3+
- `DecodeSliceError::OutputSliceTooSmall` is now conservative rather than precise. That is, the error will only occur if the decoded output _cannot_ fit, meaning that `Engine::decode_slice` can now be used with exactly-sized output slices. As part of this, `Engine::internal_decode` now returns `DecodeSliceError` instead of `DecodeError`, but that is not expected to affect any external callers.
4+
- `DecodeError::InvalidLength` now refers specifically to the _number of valid symbols_ being invalid (i.e. `len % 4 == 1`), rather than just the number of input bytes. This avoids confusing scenarios when based on interpretation you could make a case for either `InvalidLength` or `InvalidByte` being appropriate.
5+
- Decoding is somewhat faster (5-10%)
6+
17
# 0.21.7
28

39
- Support getting an alphabet's contents as a str via `Alphabet::as_str()`

src/engine/general_purpose/decode.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ mod tests {
348348
let len_128 = encoded_len as u128;
349349

350350
let estimate = GeneralPurposeEstimate::new(encoded_len);
351-
assert_eq!((len_128 + 3) / 4 * 3, estimate.conservative_decoded_len as u128);
351+
assert_eq!(
352+
(len_128 + 3) / 4 * 3,
353+
estimate.conservative_decoded_len as u128
354+
);
352355
})
353356
}
354357
}

src/engine/naive.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ impl Engine for Naive {
112112
output: &mut [u8],
113113
estimate: Self::DecodeEstimate,
114114
) -> Result<DecodeMetadata, DecodeSliceError> {
115-
let complete_nonterminal_quads_len =
116-
general_purpose::decode::complete_quads_len(input, estimate.rem, output.len(), &self.decode_table)?;
115+
let complete_nonterminal_quads_len = general_purpose::decode::complete_quads_len(
116+
input,
117+
estimate.rem,
118+
output.len(),
119+
&self.decode_table,
120+
)?;
117121

118122
const BOTTOM_BYTE: u32 = 0xFF;
119123

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
unused_extern_crates,
229229
unused_import_braces,
230230
unused_results,
231-
variant_size_differences,
231+
variant_size_differences
232232
)]
233233
#![forbid(unsafe_code)]
234234
// Allow globally until https://github.com/rust-lang/rust-clippy/issues/8768 is resolved.

0 commit comments

Comments
 (0)