diff --git a/Cargo.lock b/Cargo.lock index 3fe0307b5..c9e43a6c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ dependencies = [ "percent-encoding-iri", "phf 0.11.2", "pin-project", - "prettyplease 0.2.15", + "prettyplease", "prost", "prost-reflect", "pulldown-cmark 0.9.3", @@ -152,7 +152,7 @@ dependencies = [ "unicase", "unicode-normalization", "utime", - "windows", + "windows 0.51.1", "wiremock", "zip", "zstd", @@ -2083,7 +2083,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows 0.48.0", ] [[package]] @@ -2843,18 +2843,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3259,16 +3259,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "prettyplease" version = "0.2.15" @@ -3306,9 +3296,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" dependencies = [ "bytes", "prost-derive", @@ -3316,44 +3306,44 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.9" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" dependencies = [ "bytes", "heck", - "itertools 0.10.5", - "lazy_static", + "itertools 0.11.0", "log", "multimap", + "once_cell", "petgraph", - "prettyplease 0.1.25", + "prettyplease", "prost", "prost-types", "regex", - "syn 1.0.109", + "syn 2.0.37", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.37", ] [[package]] name = "prost-reflect" -version = "0.11.5" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b823de344848e011658ac981009100818b322421676740546f8b52ed5249428" +checksum = "057237efdb71cf4b3f9396302a3d6599a92fa94063ba537b66130980ea9909f3" dependencies = [ "once_cell", "prost", @@ -3362,9 +3352,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.9" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" dependencies = [ "prost", ] @@ -5278,6 +5268,25 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 0c6f27378..6062b6855 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,16 +96,16 @@ maplit = "1.0.2" nom = "7.1.3" num-format = "0.4.4" num_cpus = "1.16.0" -num_enum = "0.6.1" +num_enum = "0.7.0" once_cell = "1.18.0" phf = { version = "0.11.2", features = ["macros"] } pin-project = "1.1.3" plist = "1.5.0" prettyplease = "0.2.15" -prost = "0.11.9" -prost-build = "0.11.9" -prost-reflect = "0.11.5" -prost-types = "0.11.9" +prost = "0.12.1" +prost-build = "0.12.1" +prost-reflect = "0.12.0" +prost-types = "0.12.1" pulldown-cmark = "0.9.3" pyo3 = { version = "0.19.2", features = ["extension-module", "abi3", "abi3-py39"] } rand = "0.8.5" diff --git a/cargo/licenses.json b/cargo/licenses.json index d730e06fc..4525f0a7e 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -1484,15 +1484,6 @@ "license_file": null, "description": "Provides types and useful methods for working with IPv4 and IPv6 network addresses, commonly called IP prefixes. The new `IpNet`, `Ipv4Net`, and `Ipv6Net` types build on the existing `IpAddr`, `Ipv4Addr`, and `Ipv6Addr` types already provided in Rust's standard library and align to their design to stay consistent. The module also provides useful traits that extend `Ipv4Addr` and `Ipv6Addr` with methods for `Add`, `Sub`, `BitAnd`, and `BitOr` operations. The module only uses stable feature so it is guaranteed to compile using the stable toolchain." }, - { - "name": "itertools", - "version": "0.10.5", - "authors": "bluss", - "repository": "https://github.com/rust-itertools/itertools", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "Extra iterator adaptors, iterator methods, free functions, and macros." - }, { "name": "itertools", "version": "0.11.0", @@ -1846,7 +1837,7 @@ }, { "name": "num_enum", - "version": "0.6.1", + "version": "0.7.0", "authors": "Daniel Wagner-Hall |Daniel Henry-Mantilla |Vincent Esche ", "repository": "https://github.com/illicitonion/num_enum", "license": "Apache-2.0 OR BSD-3-Clause OR MIT", @@ -1855,7 +1846,7 @@ }, { "name": "num_enum_derive", - "version": "0.6.1", + "version": "0.7.0", "authors": "Daniel Wagner-Hall |Daniel Henry-Mantilla |Vincent Esche ", "repository": "https://github.com/illicitonion/num_enum", "license": "Apache-2.0 OR BSD-3-Clause OR MIT", @@ -2132,15 +2123,6 @@ "license_file": null, "description": "A library intending to be a base dependency to expose a precomputed hash" }, - { - "name": "prettyplease", - "version": "0.1.25", - "authors": "David Tolnay ", - "repository": "https://github.com/dtolnay/prettyplease", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "A minimal `syn` syntax tree pretty-printer" - }, { "name": "prettyplease", "version": "0.2.15", @@ -2179,7 +2161,7 @@ }, { "name": "prost", - "version": "0.11.9", + "version": "0.12.1", "authors": "Dan Burkert |Lucio Franco ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -2188,7 +2170,7 @@ }, { "name": "prost-build", - "version": "0.11.9", + "version": "0.12.1", "authors": "Dan Burkert |Lucio Franco |Tokio Contributors ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -2197,7 +2179,7 @@ }, { "name": "prost-derive", - "version": "0.11.9", + "version": "0.12.1", "authors": "Dan Burkert |Lucio Franco |Tokio Contributors ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -2206,7 +2188,7 @@ }, { "name": "prost-reflect", - "version": "0.11.5", + "version": "0.12.0", "authors": "Andrew Hickman ", "repository": "https://github.com/andrewhickman/prost-reflect", "license": "Apache-2.0 OR MIT", @@ -2215,7 +2197,7 @@ }, { "name": "prost-types", - "version": "0.11.9", + "version": "0.12.1", "authors": "Dan Burkert |Lucio Franco ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -3617,6 +3599,24 @@ "license_file": null, "description": "Rust for Windows" }, + { + "name": "windows", + "version": "0.51.1", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Rust for Windows" + }, + { + "name": "windows-core", + "version": "0.51.1", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Rust for Windows" + }, { "name": "windows-sys", "version": "0.48.0", diff --git a/rslib/Cargo.toml b/rslib/Cargo.toml index b3d058ca6..9db07e003 100644 --- a/rslib/Cargo.toml +++ b/rslib/Cargo.toml @@ -106,5 +106,5 @@ zip.workspace = true zstd.workspace = true [target.'cfg(windows)'.dependencies.windows] -version = "0.48.0" +version = "0.51.1" features = ["Media_SpeechSynthesis", "Foundation_Collections", "Storage_Streams"] diff --git a/rslib/src/import_export/text/csv/metadata.rs b/rslib/src/import_export/text/csv/metadata.rs index f593cc3d8..f39fce71d 100644 --- a/rslib/src/import_export/text/csv/metadata.rs +++ b/rslib/src/import_export/text/csv/metadata.rs @@ -308,7 +308,7 @@ pub(super) trait DupeResolutionExt: Sized { impl DupeResolutionExt for DupeResolution { fn from_config(col: &Collection) -> Self { - Self::from_i32(col.get_config_i32(I32ConfigKey::CsvDuplicateResolution)).unwrap_or_default() + Self::try_from(col.get_config_i32(I32ConfigKey::CsvDuplicateResolution)).unwrap_or_default() } fn from_text(text: &str) -> Option { @@ -328,7 +328,7 @@ pub(super) trait MatchScopeExt: Sized { impl MatchScopeExt for MatchScope { fn from_config(col: &Collection) -> Self { - Self::from_i32(col.get_config_i32(I32ConfigKey::MatchScope)).unwrap_or_default() + Self::try_from(col.get_config_i32(I32ConfigKey::MatchScope)).unwrap_or_default() } fn from_text(text: &str) -> Option { diff --git a/rslib/src/links.rs b/rslib/src/links.rs index 29352be53..2f39acd6c 100644 --- a/rslib/src/links.rs +++ b/rslib/src/links.rs @@ -49,6 +49,6 @@ impl crate::services::LinksService for Collection { &mut self, input: anki_proto::links::HelpPageLinkRequest, ) -> error::Result { - Ok(help_page_to_link(HelpPage::from_i32(input.page).unwrap_or(HelpPage::Index)).into()) + Ok(help_page_to_link(HelpPage::try_from(input.page).unwrap_or(HelpPage::Index)).into()) } } diff --git a/rslib/src/notetype/service.rs b/rslib/src/notetype/service.rs index f1950f0f5..fd1dcf18b 100644 --- a/rslib/src/notetype/service.rs +++ b/rslib/src/notetype/service.rs @@ -204,7 +204,7 @@ impl crate::services::NotetypesService for Collection { &mut self, input: anki_proto::notetypes::RestoreNotetypeToStockRequest, ) -> error::Result { - let force_kind = input.force_kind.and_then(StockKind::from_i32); + let force_kind = input.force_kind.and_then(|s| StockKind::try_from(s).ok()); self.restore_notetype_to_stock( input.notetype_id.or_invalid("missing notetype id")?.into(), diff --git a/rslib/src/scheduler/service/mod.rs b/rslib/src/scheduler/service/mod.rs index f63dfa390..6a3895c2b 100644 --- a/rslib/src/scheduler/service/mod.rs +++ b/rslib/src/scheduler/service/mod.rs @@ -135,7 +135,7 @@ impl crate::services::SchedulerService for Collection { input.reset_counts, input .context - .and_then(scheduler::schedule_cards_as_new_request::Context::from_i32), + .and_then(|s| scheduler::schedule_cards_as_new_request::Context::try_from(s).ok()), ) .map(Into::into) } diff --git a/rslib/src/search/service/mod.rs b/rslib/src/search/service/mod.rs index 6d95eb681..4cbe5c455 100644 --- a/rslib/src/search/service/mod.rs +++ b/rslib/src/search/service/mod.rs @@ -58,7 +58,7 @@ impl crate::services::SearchService for Collection { let additional_node: Node = input.additional_node.unwrap_or_default().try_into()?; Ok( - match anki_proto::search::search_node::group::Joiner::from_i32(input.joiner) + match anki_proto::search::search_node::group::Joiner::try_from(input.joiner) .unwrap_or_default() { anki_proto::search::search_node::group::Joiner::And => { diff --git a/rslib/src/search/service/search_node.rs b/rslib/src/search/service/search_node.rs index ce533d191..1851a28f7 100644 --- a/rslib/src/search/service/search_node.rs +++ b/rslib/src/search/service/search_node.rs @@ -58,11 +58,11 @@ impl TryFrom for Node { }), Filter::EditedInDays(u) => Node::Search(SearchNode::EditedInDays(u)), Filter::CardState(state) => Node::Search(SearchNode::State( - anki_proto::search::search_node::CardState::from_i32(state) + anki_proto::search::search_node::CardState::try_from(state) .unwrap_or_default() .into(), )), - Filter::Flag(flag) => match Flag::from_i32(flag).unwrap_or(Flag::Any) { + Filter::Flag(flag) => match Flag::try_from(flag).unwrap_or(Flag::Any) { Flag::None => Node::Search(SearchNode::Flag(0)), Flag::Any => Node::Not(Box::new(Node::Search(SearchNode::Flag(0)))), Flag::Red => Node::Search(SearchNode::Flag(1)),