Skip to main content

max / goingson

Describe the mail list's remainder as a window and a total Rest derives what is left now, off the pair this function already had in hand: the old shape took the subtraction and threw the more informative halves away on the way in.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-16 20:13 UTC
Signed with PGP, not checked
Commit: 91786effa97fced38375d9b501230dce49f8c49b
Parent: 666d866
4 files changed, +49 insertions, -45 deletions
M Cargo.lock +33 -35
@@ -1367,7 +1367,7 @@
1367 1367 "libc",
1368 1368 "option-ext",
1369 1369 "redox_users",
1370 - "windows-sys 0.60.2",
1370 + "windows-sys 0.61.2",
1371 1371 ]
1372 1372
1373 1373 [[package]]
@@ -1608,7 +1608,7 @@
1608 1608 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
1609 1609 dependencies = [
1610 1610 "libc",
1611 - "windows-sys 0.60.2",
1611 + "windows-sys 0.61.2",
1612 1612 ]
1613 1613
1614 1614 [[package]]
@@ -3415,9 +3415,7 @@
3415 3415
3416 3416 [[package]]
3417 3417 name = "makeover-layout"
3418 - version = "0.27.0"
3419 - source = "registry+https://github.com/rust-lang/crates.io-index"
3420 - checksum = "70c07e8b5020bf12ced1aea9313ebf0d4ca764ce2de6ef0d95eddc7d34bd939a"
3418 + version = "0.27.3"
3421 3419
3422 3420 [[package]]
3423 3421 name = "makeover-touch"
@@ -3593,7 +3591,7 @@
3593 3591 "png 0.18.1",
3594 3592 "serde",
3595 3593 "thiserror 2.0.20",
3596 - "windows-sys 0.60.2",
3594 + "windows-sys 0.61.2",
3597 3595 ]
3598 3596
3599 3597 [[package]]
@@ -3726,7 +3724,7 @@
3726 3724 source = "registry+https://github.com/rust-lang/crates.io-index"
3727 3725 checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
3728 3726 dependencies = [
3729 - "windows-sys 0.60.2",
3727 + "windows-sys 0.61.2",
3730 3728 ]
3731 3729
3732 3730 [[package]]
@@ -4651,7 +4649,7 @@
4651 4649
4652 4650 [[package]]
4653 4651 name = "quasi-http"
4654 - version = "0.14.0"
4652 + version = "0.15.0"
4655 4653 dependencies = [
4656 4654 "form_urlencoded",
4657 4655 "http",
@@ -4660,14 +4658,14 @@
4660 4658
4661 4659 [[package]]
4662 4660 name = "quasi-router"
4663 - version = "0.14.0"
4661 + version = "0.15.0"
4664 4662 dependencies = [
4665 4663 "makeover-layout",
4666 4664 ]
4667 4665
4668 4666 [[package]]
4669 4667 name = "quasi-tauri"
4670 - version = "0.14.0"
4668 + version = "0.15.0"
4671 4669 dependencies = [
4672 4670 "http",
4673 4671 "quasi-http",
@@ -4677,7 +4675,7 @@
4677 4675
4678 4676 [[package]]
4679 4677 name = "quasi-webview"
4680 - version = "0.14.0"
4678 + version = "0.15.0"
4681 4679 dependencies = [
4682 4680 "docengine",
4683 4681 "makeover-layout",
@@ -4999,7 +4997,7 @@
4999 4997 "pin-project-lite",
5000 4998 "rustls",
5001 4999 "rustls-pki-types",
5002 - "rustls-platform-verifier 0.6.2",
5000 + "rustls-platform-verifier 0.7.0",
5003 5001 "serde",
5004 5002 "serde_json",
5005 5003 "serde_urlencoded",
@@ -5105,7 +5103,7 @@
5105 5103 "errno",
5106 5104 "libc",
5107 5105 "linux-raw-sys",
5108 - "windows-sys 0.60.2",
5106 + "windows-sys 0.61.2",
5109 5107 ]
5110 5108
5111 5109 [[package]]
@@ -5162,7 +5160,7 @@
5162 5160 "security-framework",
5163 5161 "security-framework-sys",
5164 5162 "webpki-root-certs",
5165 - "windows-sys 0.60.2",
5163 + "windows-sys 0.61.2",
5166 5164 ]
5167 5165
5168 5166 [[package]]
@@ -5183,7 +5181,7 @@
5183 5181 "security-framework",
5184 5182 "security-framework-sys",
5185 5183 "webpki-root-certs",
5186 - "windows-sys 0.60.2",
5184 + "windows-sys 0.61.2",
5187 5185 ]
5188 5186
5189 5187 [[package]]
@@ -5713,7 +5711,7 @@
5713 5711 checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
5714 5712 dependencies = [
5715 5713 "libc",
5716 - "windows-sys 0.60.2",
5714 + "windows-sys 0.61.2",
5717 5715 ]
5718 5716
5719 5717 [[package]]
@@ -6488,7 +6486,7 @@
6488 6486 "getrandom 0.4.3",
6489 6487 "once_cell",
6490 6488 "rustix",
6491 - "windows-sys 0.60.2",
6489 + "windows-sys 0.61.2",
6492 6490 ]
6493 6491
6494 6492 [[package]]
@@ -6510,7 +6508,7 @@
6510 6508 "parking_lot",
6511 6509 "rustix",
6512 6510 "signal-hook",
6513 - "windows-sys 0.60.2",
6511 + "windows-sys 0.61.2",
6514 6512 ]
6515 6513
6516 6514 [[package]]
@@ -6992,7 +6990,7 @@
6992 6990 "png 0.18.1",
6993 6991 "serde",
6994 6992 "thiserror 2.0.20",
6995 - "windows-sys 0.60.2",
6993 + "windows-sys 0.61.2",
6996 6994 ]
6997 6995
6998 6996 [[package]]
@@ -7027,7 +7025,7 @@
7027 7025 dependencies = [
7028 7026 "memoffset",
7029 7027 "tempfile",
7030 - "windows-sys 0.60.2",
7028 + "windows-sys 0.61.2",
7031 7029 ]
7032 7030
7033 7031 [[package]]
@@ -7548,7 +7546,7 @@
7548 7546 source = "registry+https://github.com/rust-lang/crates.io-index"
7549 7547 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
7550 7548 dependencies = [
7551 - "windows-sys 0.60.2",
7549 + "windows-sys 0.61.2",
7552 7550 ]
7553 7551
7554 7552 [[package]]
@@ -8374,21 +8372,21 @@
8374 8372 ]
8375 8373
8376 8374 [[patch.unused]]
8377 - name = "quasi-axum"
8378 - version = "0.14.0"
8379 -
8380 - [[patch.unused]]
8381 - name = "quasi-basics"
8382 - version = "0.14.0"
8383 -
8384 - [[patch.unused]]
8385 - name = "quasi-immediate"
8386 - version = "0.14.0"
8387 -
8388 - [[patch.unused]]
8389 - name = "quasi-store"
8375 + name = "ops-status"
8390 8376 version = "0.1.0"
8391 8377
8392 8378 [[patch.unused]]
8393 - name = "ops-status"
8379 + name = "quasi-axum"
8380 + version = "0.15.0"
8381 +
8382 + [[patch.unused]]
8383 + name = "quasi-basics"
8384 + version = "0.15.0"
8385 +
8386 + [[patch.unused]]
8387 + name = "quasi-immediate"
8388 + version = "0.15.0"
8389 +
8390 + [[patch.unused]]
8391 + name = "quasi-store"
8394 8392 version = "0.1.0"
@@ -32,7 +32,7 @@
32 32 # `quasi` feature. Optional here as well as below so a default build compiles
33 33 # neither: one `dep:` name covers both tables, which is what lets the feature
34 34 # gate the build script and the crate together.
35 - quasi-webview = { git = "https://makenot.work/git/max/quasi.git", version = "0.14", optional = true }
35 + quasi-webview = { git = "https://makenot.work/git/max/quasi.git", version = "0.15", optional = true }
36 36
37 37 [dependencies]
38 38 goingson-core = { workspace = true }
@@ -50,10 +50,10 @@
50 50 # dependency's source even with the feature off -- so a public clone could not
51 51 # build at all against a URL it could not reach. quasi went public that day and
52 52 # the URL moved here with it.
53 - quasi-router = { git = "https://makenot.work/git/max/quasi.git", version = "0.14", optional = true }
54 - quasi-http = { git = "https://makenot.work/git/max/quasi.git", version = "0.14", optional = true }
55 - quasi-webview = { git = "https://makenot.work/git/max/quasi.git", version = "0.14", optional = true }
56 - quasi-tauri = { git = "https://makenot.work/git/max/quasi.git", version = "0.14", optional = true }
53 + quasi-router = { git = "https://makenot.work/git/max/quasi.git", version = "0.15", optional = true }
54 + quasi-http = { git = "https://makenot.work/git/max/quasi.git", version = "0.15", optional = true }
55 + quasi-webview = { git = "https://makenot.work/git/max/quasi.git", version = "0.15", optional = true }
56 + quasi-tauri = { git = "https://makenot.work/git/max/quasi.git", version = "0.15", optional = true }
57 57
58 58 # Tauri
59 59 tauri = { workspace = true, features = ["image-png", "devtools"] }
@@ -431,14 +431,19 @@
431 431
432 432 let shown = i64::try_from(rows.len()).unwrap_or(i64::MAX);
433 433 let more = (total > shown).then(|| {
434 + // The window and the total, rather than the subtraction of the two.
435 + // `Rest` derives what is left, and it is the pair this function already
436 + // had in hand: the old shape took `remaining` and threw the more
437 + // informative halves away on the way in.
434 438 Rest::more(
439 + usize::try_from(shown).unwrap_or(usize::MAX),
435 440 View {
436 441 shown: view.shown + PAGE,
437 442 ..view.clone()
438 443 }
439 444 .list(),
440 445 )
441 - .remaining(u32::try_from(total - shown).unwrap_or(u32::MAX))
446 + .of(usize::try_from(total).unwrap_or(usize::MAX))
442 447 });
443 448
444 449 Ok(Node::List { rows, more })
@@ -193,9 +193,10 @@
193 193
194 194 #[tokio::test]
195 195 async fn the_remainder_is_a_real_count_and_a_way_to_ask_for_more() {
196 - // The second finding, which is a confirmation: `Rest::remaining` was added
197 - // expecting to be `None` most of the time, and `list_threaded` returns the
198 - // total in the same call, so both numbers are honest here.
196 + // The second finding, which is a confirmation: the remainder was expected to
197 + // be unknown most of the time, and `list_threaded` returns the total in the
198 + // same call, so the number is honest here. It is derived now rather than
199 + // stored, off the window and the total this screen already had.
199 200 let state = state().await;
200 201 for index in 0..=super::PAGE {
201 202 let mut mail = message(&format!("Message {index}"));
@@ -207,7 +208,7 @@
207 208
208 209 let rest = remainder(get(&state, "/emails/list", Params::new()))
209 210 .expect("201 messages do not fit in one page");
210 - assert_eq!(rest.remaining, Some(1));
211 + assert_eq!(rest.as_layout().remaining(), Some(1));
211 212
212 213 // And asking for more is an address, so the wider list is reachable
213 214 // directly rather than by having scrolled to it.