anki/rslib
Damien Elmes dac532953e
Refactor progress handling (#2549)
Previously it was Backend's responsibility to store the last progress,
and when calling routines in Collection, one had to construct and pass
in a Fn, which wasn't the most ergonomic. This PR adds the last progress
state to the collection, so that the routines no longer need a separate
progress arg, and makes some other tweaks to improve ergonomics.

ThrottlingProgressHandler has been tweaked so that it now stores the
current state, so that callers don't need to store it separately. When
a long-running routine starts, it calls col.new_progress_handler(),
which automatically initializes the data to defaults, and updates the
shared UI state, so we no longer need to manually update the state at
the start of an operation.

The backend shares the Arc<Mutex<>> with the collection, so it can get
at the current state, and so we can update the state when importing a
backup.

Other tweaks:

- The current Incrementor was awkward to use in the media check, which
uses a single incrementing value across multiple method calls, so I've
added a simpler alternative for such cases. The old incrementor method
has been kept, but implemented directly on ThrottlingProgressHandler.
- The full sync code was passing the progress handler in a complicated
way that may once have been required, but no longer is.
- On the Qt side, timers are now stopped before deletion, or they keep
running for a few seconds.
- I left the ChangeTracker using a closure, as it's used for both importing
and syncing.
2023-06-19 13:48:32 +10:00
..
benches Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
i18n Add support for using n2 instead of ninja 2023-06-15 17:17:56 +10:00
i18n_helpers Update Rust deps 2023-03-31 14:38:24 +10:00
io Check for stale licenses.json in minilints 2023-06-17 14:01:27 +10:00
linkchecker Move generated protobuf into anki_proto 2023-06-12 15:47:51 +10:00
process Include cmdline in error display; show cargo install progress 2023-06-17 14:55:55 +10:00
proto Include backend comments in Python and Rust codegen 2023-06-16 10:59:00 +10:00
src Refactor progress handling (#2549) 2023-06-19 13:48:32 +10:00
tests/support move linkchecker into separate crate 2021-12-20 17:27:43 +10:00
.gitignore initial Bazel conversion 2020-11-01 14:26:58 +10:00
bench.sh New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
build.rs Move protobuf generation into a separate crate; write .py interface in Rust 2023-06-12 09:52:00 +10:00
Cargo.toml Fix rsbridge build when 1.61 snafu feature enabled 2023-06-17 12:44:25 +10:00
README.md Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00

Anki's Rust code.