Skip to content

Commit

Permalink
Release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallpierce committed Mar 2, 2024
1 parent 2b91084 commit efb6c00
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "base64"
version = "0.21.7"
version = "0.22.0"
authors = ["Alice Maz <alice@alicemaz.com>", "Marshall Pierce <marshall@mpierce.org>"]
description = "encodes and decodes base64 as bytes or utf8"
repository = "https://github.com/marshallpierce/rust-base64"
Expand Down
6 changes: 6 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.22.0

- `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.
- `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.
- Decoding is somewhat faster (5-10%)

# 0.21.7

- Support getting an alphabet's contents as a str via `Alphabet::as_str()`
Expand Down
5 changes: 4 additions & 1 deletion src/engine/general_purpose/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ mod tests {
let len_128 = encoded_len as u128;

let estimate = GeneralPurposeEstimate::new(encoded_len);
assert_eq!((len_128 + 3) / 4 * 3, estimate.conservative_decoded_len as u128);
assert_eq!(
(len_128 + 3) / 4 * 3,
estimate.conservative_decoded_len as u128
);
})
}
}
8 changes: 6 additions & 2 deletions src/engine/naive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ impl Engine for Naive {
output: &mut [u8],
estimate: Self::DecodeEstimate,
) -> Result<DecodeMetadata, DecodeSliceError> {
let complete_nonterminal_quads_len =
general_purpose::decode::complete_quads_len(input, estimate.rem, output.len(), &self.decode_table)?;
let complete_nonterminal_quads_len = general_purpose::decode::complete_quads_len(
input,
estimate.rem,
output.len(),
&self.decode_table,
)?;

const BOTTOM_BYTE: u32 = 0xFF;

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
unused_extern_crates,
unused_import_braces,
unused_results,
variant_size_differences,
variant_size_differences
)]
#![forbid(unsafe_code)]
// Allow globally until https://github.com/rust-lang/rust-clippy/issues/8768 is resolved.
Expand Down

0 comments on commit efb6c00

Please sign in to comment.