anki/rslib/Cargo.toml
RumovZ c521753057
Refactor error handling (#2136)
* Add crate snafu

* Replace all inline structs in AnkiError

* Derive Snafu on AnkiError

* Use snafu for card type errors

* Use snafu whatever error for InvalidInput

* Use snafu for NotFoundError and improve message

* Use snafu for FileIoError to attach context

Remove IoError.
Add some context-attaching helpers to replace code returning bare
io::Errors.

* Add more context-attaching io helpers

* Add message, context and backtrace to new snafus

* Utilize error context and backtrace on frontend

* Rename LocalizedError -> BackendError.
* Remove DocumentedError.
* Have all backend exceptions inherit BackendError.

* Rename localized(_description) -> message

* Remove accidentally committed experimental trait

* invalid_input_context -> ok_or_invalid

* ensure_valid_input! -> require!

* Always return `Err` from `invalid_input!`

Instead of a Result to unwrap, the macro accepts a source error now.

* new_tempfile_in_parent -> new_tempfile_in_parent_of

* ok_or_not_found -> or_not_found

* ok_or_invalid -> or_invalid

* Add crate convert_case

* Use unqualified lowercase type name

* Remove uses of snafu::ensure

* Allow public construction of InvalidInputErrors (dae)

Needed to port the AnkiDroid changes.

* Make into_protobuf() public (dae)

Also required for AnkiDroid. Not sure why it worked previously - possible
bug in older Rust version?
2022-10-21 18:02:12 +10:00

108 lines
2.8 KiB
TOML

[package]
name = "anki"
version = "0.0.0"
edition = "2021"
authors = ["Ankitects Pty Ltd and contributors"]
license = "AGPL-3.0-or-later"
description = "Anki's Rust library code"
build = "build/main.rs"
[lib]
name = "anki"
path = "src/lib.rs"
[features]
bench = ["criterion"]
[[bench]]
name = "benchmark"
harness = false
required-features = ["bench"]
# After updating anything below, run ../cargo/update.py
[build-dependencies]
prost-build = "0.11.1"
which = "4.3.0"
[dev-dependencies]
env_logger = "0.9.1"
tokio = { version = "1.21", features = ["macros"] }
[dependencies]
# pinned as any changes could invalidate sqlite indexes
unicase = "=2.6.0"
tokio = { version = "1.21", features = ["fs", "rt-multi-thread"] }
anki_i18n = { path="i18n" }
criterion = { version = "0.4.0", optional = true }
nom = "7.1.1"
proc-macro-nested = "0.1.7"
slog-term = "2.9.0"
blake3 = "1.3.1"
bytes = "1.2.1"
chrono = "0.4.22"
coarsetime = "0.1.22"
flate2 = "1.0.24"
fluent = "0.16.0"
fluent-bundle = "0.15.2"
futures = "0.3.24"
hex = "0.4.3"
htmlescape = "0.3.1"
intl-memoizer = "0.5.1"
itertools = "0.10.5"
lazy_static = "1.4.0"
num_enum = "0.5.7"
num-integer = "0.1.45"
once_cell = "1.15.0"
pin-project = "1.0.12"
prost = "0.11.0"
rand = "0.8.5"
regex = "1.6.0"
reqwest = { git="https://github.com/ankitects/reqwest.git", rev="7591444614de02b658ddab125efba7b2bb4e2335", default-features=false, features=[
"json",
"socks",
"stream",
"multipart",
# the Bazel build scripts separate these out by platform
"native-tls",
"rustls-tls",
"rustls-tls-webpki-roots",
"rustls-tls-native-roots",
] }
rusqlite = { version = "0.28.0", features = ["trace", "functions", "collation", "bundled"] }
scopeguard = "1.1.0"
serde = "1.0.145"
serde_derive = "1.0.145"
serde_json = "1.0.85"
serde_repr = "0.1.9"
serde_tuple = "0.5.0"
serde-aux = "4.0.0"
sha1 = "0.6.0"
slog = { version = "2.7.0", features = ["max_level_trace", "release_max_level_debug"] }
slog-async = "2.7.0"
slog-envlogger = "2.2.0"
tempfile = "3.3.0"
unic-langid = { version = "0.9.0", features = ["macros"] }
unicode-normalization = "0.1.22"
utime = "0.3.1"
zip = { version = "0.6.2", default-features = false, features = ["deflate", "time"] }
async-trait = "0.1.57"
ammonia = "3.2.1"
pulldown-cmark = "0.9.2"
fnv = "1.0.7"
strum = { version = "0.24.1", features = ["derive"] }
tokio-util = { version = "0.7.4", features = ["io"] }
pct-str = { git="https://github.com/timothee-haudebourg/pct-str.git", rev="4adccd8d4a222ab2672350a102f06ae832a0572d" }
unic-ucd-category = "0.9.0"
id_tree = "1.8.0"
zstd = { version="0.11.2", features=["zstdmt"] }
num_cpus = "1.13.1"
csv = { git="https://github.com/ankitects/rust-csv.git", rev="1c9d3aab6f79a7d815c69f925a46a4590c115f90" }
dissimilar = "1.0.4"
snafu = { version = "0.7.2", features = ["backtraces"] }
convert_case = "0.6.0"