Skip to content

Commit fd8ba06

Browse files
committed
release: 0.11.0
2 parents 732e642 + 8dc96bf commit fd8ba06

8 files changed

Lines changed: 44 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33

44

5+
## [0.11.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.11.0) - 2025-06-26
6+
7+
### Changed
8+
9+
* Bump `brunch` to `0.11` (dev)
10+
* Bump `dactyl` to `0.13`
11+
* Bump `trimothy` to `0.9`
12+
* Bump MSRV to `1.88`
13+
* Impl `FusedIterator` for `Tracks`
14+
* Miscellaneous code cleanup and lints
15+
16+
17+
518
## [0.10.0](https://github.com/Blobfolio/cdtoc/releases/tag/v0.10.0) - 2025-06-01
619

720
### Changed

CREDITS.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# Project Dependencies
22
Package: cdtoc
3-
Version: 0.10.0
4-
Generated: 2025-06-02 04:54:55 UTC
3+
Version: 0.11.0
4+
Generated: 2025-06-26 20:18:46 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
8-
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.12.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
8+
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.13.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
99
| [**faster-hex**](https://github.com/NervosFoundation/faster-hex) | 0.10.0 | [zhangsoledad](mailto:787953403@qq.com) | MIT |
10-
| [**trimothy**](https://github.com/Blobfolio/trimothy) | 0.8.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
10+
| [**trimothy**](https://github.com/Blobfolio/trimothy) | 0.9.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1111
| [_block-buffer_](https://github.com/RustCrypto/utils) | 0.10.4 | RustCrypto Developers | MIT OR Apache-2.0 |
1212
| [_byteorder_](https://github.com/BurntSushi/byteorder) | 1.5.0 | [Andrew Gallant](mailto:jamslam@gmail.com) | Unlicense OR MIT |
13-
| [_cc_](https://github.com/rust-lang/cc-rs) ⚒️ | 1.2.25 | [Alex Crichton](mailto:alex@alexcrichton.com) | MIT OR Apache-2.0 |
14-
| [_cfg-if_](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:alex@alexcrichton.com) | MIT OR Apache-2.0 |
13+
| [_cc_](https://github.com/rust-lang/cc-rs) ⚒️ | 1.2.27 | [Alex Crichton](mailto:alex@alexcrichton.com) | MIT OR Apache-2.0 |
14+
| [_cfg-if_](https://github.com/rust-lang/cfg-if) | 1.0.1 | [Alex Crichton](mailto:alex@alexcrichton.com) | MIT OR Apache-2.0 |
1515
| [_cpufeatures_](https://github.com/RustCrypto/utils) | 0.2.17 | RustCrypto Developers | MIT OR Apache-2.0 |
1616
| [_crypto-common_](https://github.com/RustCrypto/traits) | 0.1.6 | RustCrypto Developers | MIT OR Apache-2.0 |
1717
| [_digest_](https://github.com/RustCrypto/traits) | 0.10.7 | RustCrypto Developers | MIT OR Apache-2.0 |
1818
| [_generic-array_](https://github.com/fizyk20/generic-array.git) | 0.14.7 | [Bartłomiej Kamiński](mailto:fizyk20@gmail.com) and [Aaron Trent](mailto:novacrazy@gmail.com) | MIT |
1919
| [_hash32_](https://github.com/japaric/hash32) | 0.3.1 | [Jorge Aparicio](mailto:jorge@japaric.io) | MIT OR Apache-2.0 |
2020
| [_heapless_](https://github.com/rust-embedded/heapless) | 0.8.0 | [Jorge Aparicio](mailto:jorge@japaric.io), [Per Lindgren](mailto:per.lindgren@ltu.se), and [Emil Fresk](mailto:emil.fresk@gmail.com) | MIT OR Apache-2.0 |
2121
| [**_itoa_**](https://github.com/dtolnay/itoa) | 1.0.15 | [David Tolnay](mailto:dtolnay@gmail.com) | MIT OR Apache-2.0 |
22-
| [_libc_](https://github.com/rust-lang/libc) | 0.2.172 | The Rust Project Developers | MIT OR Apache-2.0 |
22+
| [_libc_](https://github.com/rust-lang/libc) | 0.2.174 | The Rust Project Developers | MIT OR Apache-2.0 |
2323
| [_proc-macro2_](https://github.com/dtolnay/proc-macro2) ⚒️ | 1.0.95 | [David Tolnay](mailto:dtolnay@gmail.com) and [Alex Crichton](mailto:alex@alexcrichton.com) | MIT OR Apache-2.0 |
2424
| [_quote_](https://github.com/dtolnay/quote) ⚒️ | 1.0.40 | [David Tolnay](mailto:dtolnay@gmail.com) | MIT OR Apache-2.0 |
2525
| [**_serde_**](https://github.com/serde-rs/serde) | 1.0.219 | [Erick Tryzelaar](mailto:erick.tryzelaar@gmail.com) and [David Tolnay](mailto:dtolnay@gmail.com) | MIT OR Apache-2.0 |
@@ -28,7 +28,7 @@
2828
| [_sha1-asm_](https://github.com/RustCrypto/asm-hashes) | 0.5.3 | RustCrypto Developers | MIT |
2929
| [_shlex_](https://github.com/comex/rust-shlex) ⚒️ | 1.3.0 | [comex](mailto:comexk@gmail.com), [Fenhl](mailto:fenhl@fenhl.net), [Adrian Taylor](mailto:adetaylor@chromium.org), [Alex Touchet](mailto:alextouchet@outlook.com), [Daniel Parks](mailto:dp+git@oxidized.org), and [Garrett Berg](mailto:googberg@gmail.com) | MIT OR Apache-2.0 |
3030
| [_stable_deref_trait_](https://github.com/storyyeller/stable_deref_trait) | 1.2.0 | [Robert Grosse](mailto:n210241048576@gmail.com) | MIT OR Apache-2.0 |
31-
| [_syn_](https://github.com/dtolnay/syn) ⚒️ | 2.0.101 | [David Tolnay](mailto:dtolnay@gmail.com) | MIT OR Apache-2.0 |
31+
| [_syn_](https://github.com/dtolnay/syn) ⚒️ | 2.0.104 | [David Tolnay](mailto:dtolnay@gmail.com) | MIT OR Apache-2.0 |
3232
| [_typenum_](https://github.com/paholg/typenum) | 1.18.0 | [Paho Lurie-Gregg](mailto:paho@paholg.com) and [Andre Bogus](mailto:bogusandre@gmail.com) | MIT OR Apache-2.0 |
3333
| [_unicode-ident_](https://github.com/dtolnay/unicode-ident) ⚒️ | 1.0.18 | [David Tolnay](mailto:dtolnay@gmail.com) | (MIT OR Apache-2.0) AND Unicode-3.0 |
3434
| [_version_check_](https://github.com/SergioBenitez/version_check) ⚒️ | 0.9.5 | [Sergio Benitez](mailto:sb@sergio.bz) | MIT OR Apache-2.0 |

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "cdtoc"
3-
version = "0.10.0"
3+
version = "0.11.0"
44
authors = ["Josh Stoik <josh@blobfolio.com>"]
55
edition = "2024"
6-
rust-version = "1.87"
6+
rust-version = "1.88"
77
description = "Parser and tools for CDTOC metadata tags."
88
license = "WTFPL"
99
repository = "https://github.com/Blobfolio/cdtoc"
@@ -27,12 +27,12 @@ features = [ "accuraterip", "cddb", "ctdb", "musicbrainz", "serde" ]
2727
default-target = "x86_64-unknown-linux-gnu"
2828

2929
[dev-dependencies]
30-
brunch = "0.10.*"
30+
brunch = "0.11.*"
3131
serde_json = "1.0.*"
3232

3333
[dependencies]
34-
dactyl = "0.12.*"
35-
trimothy = "0.8.*"
34+
dactyl = "0.13.*"
35+
trimothy = "0.9.*"
3636

3737
[dependencies.faster-hex]
3838
version = "0.10.*"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ Add `cdtoc` to your `dependencies` in `Cargo.toml`, like:
6262

6363
```toml
6464
[dependencies]
65-
cdtoc = "0.10.*"
65+
cdtoc = "0.11.*"
6666
```
6767

6868
The disc ID helpers require additional dependencies, so if you aren't using them, be sure to disable the default features (adding back any you _do_ want) to skip the overhead.
6969

7070
```toml
7171
[dependencies.cdtoc]
72-
version = "0.10.*"
72+
version = "0.11.*"
7373
default-features = false
7474
```

src/ctdb.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ impl Toc {
4949

5050
// Split the leadin from the rest of the sectors.
5151
let [leadin, sectors @ ..] = self.audio_sectors() else { unreachable!() };
52-
let len = sectors.len();
53-
let rem = len % CHUNK_SIZE;
5452

5553
// Process the sector positions in batches of four to leverage SSE hex
5654
// optimizations.
57-
for v in sectors.chunks_exact(CHUNK_SIZE) {
55+
let (chunks, rest) = sectors.as_chunks::<CHUNK_SIZE>();
56+
for v in chunks {
5857
// Copy the values to the source buffer.
5958
for (s_chunk, v) in src.chunks_exact_mut(4).zip(v.iter().map(|n| n - leadin)) {
6059
s_chunk.copy_from_slice(v.to_be_bytes().as_slice());
@@ -67,7 +66,7 @@ impl Toc {
6766
}
6867

6968
// Handle the remaining sectors, if any, and the leadout.
70-
if rem == 0 {
69+
if rest.is_empty() {
7170
let dst2 = &mut dst[..8];
7271
faster_hex::hex_encode_fallback((self.audio_leadout() - leadin).to_be_bytes().as_slice(), dst2);
7372
dst2.make_ascii_uppercase();
@@ -76,22 +75,22 @@ impl Toc {
7675
else {
7776
// Copy the values to the source buffer.
7877
for (s_chunk, v) in src.chunks_exact_mut(4).zip(
79-
sectors[len - rem..].iter().map(|n| n - leadin)
78+
rest.iter().map(|n| n - leadin)
8079
.chain(std::iter::once(self.audio_leadout() - leadin))
8180
) {
8281
s_chunk.copy_from_slice(v.to_be_bytes().as_slice());
8382
}
8483

8584
// Encode and hash, en masse.
86-
let src_to = rem * 4 + 4;
85+
let src_to = rest.len() * 4 + 4;
8786
let dst2 = &mut dst[..src_to * 2];
8887
faster_hex::hex_encode(&src[..src_to], dst2).unwrap();
8988
dst2.make_ascii_uppercase();
9089
sha.update(dst2);
9190
}
9291

9392
// And padding for a total of 99 tracks.
94-
let padding = 99 - len;
93+
let padding = 99 - sectors.len();
9594
if padding != 0 { sha.update(&crate::ZEROES[..padding * 8]); }
9695

9796
// Run it through base64 and we're done!

src/musicbrainz.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ impl Toc {
5858
// Process the sector positions in batches of four to leverage SSE hex
5959
// optimizations.
6060
let sectors = self.audio_sectors();
61-
let len = sectors.len();
62-
let rem = len % CHUNK_SIZE;
63-
for v in sectors.chunks_exact(CHUNK_SIZE) {
61+
let (chunks, rest) = sectors.as_chunks::<CHUNK_SIZE>();
62+
for v in chunks {
6463
// Copy the values to the source buffer.
6564
for (s_chunk, v) in src.chunks_exact_mut(4).zip(v) {
6665
s_chunk.copy_from_slice(v.to_be_bytes().as_slice());
@@ -73,14 +72,14 @@ impl Toc {
7372
}
7473

7574
// Handle the remaining sectors, if any,
76-
if rem != 0 {
75+
if ! rest.is_empty() {
7776
// Copy the values to the source buffer.
78-
for (s_chunk, v) in src.chunks_exact_mut(4).zip(sectors[len - rem..].iter()) {
77+
for (s_chunk, v) in src.chunks_exact_mut(4).zip(rest.iter()) {
7978
s_chunk.copy_from_slice(v.to_be_bytes().as_slice());
8079
}
8180

8281
// Encode and hash, en masse.
83-
let src_to = rem * 4;
82+
let src_to = rest.len() * 4;
8483
let dst2 = &mut dst[..src_to * 2];
8584
faster_hex::hex_encode_fallback(&src[..src_to], dst2);
8685
dst2.make_ascii_uppercase();

src/time.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
use crate::TocError;
66
use dactyl::{
77
NiceElapsed,
8-
traits::{
9-
IntDivFloat,
10-
NiceInflection,
11-
},
8+
NiceFloat,
9+
traits::NiceInflection,
1210
};
1311
use std::{
1412
fmt,
@@ -260,7 +258,7 @@ impl Duration {
260258
let (s, rem) = (total_samples.wrapping_div(sample_rate), total_samples % sample_rate);
261259
if rem == 0 { Self(s * SECTORS_PER_SECOND) }
262260
else {
263-
let f = (rem * 75).div_float(sample_rate)
261+
let f = NiceFloat::div_u64(rem * 75, sample_rate)
264262
.map_or(0, |f| f.trunc() as u64);
265263
Self(s * SECTORS_PER_SECOND + f)
266264
}

src/track.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ impl ExactSizeIterator for Tracks<'_> {
297297
fn len(&self) -> usize { self.tracks.len().saturating_sub(self.pos) }
298298
}
299299

300+
impl std::iter::FusedIterator for Tracks<'_> {}
301+
300302
impl<'a> Tracks<'a> {
301303
/// # New.
302304
pub(super) const fn new(tracks: &'a [u32], leadout: u32) -> Self {

0 commit comments

Comments
 (0)