Bug 1899617 - Update application-services to pick up new rusqlite/sqlite. r=lina,supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D212047
This commit is contained in:
Mark Hammond 2024-05-29 20:34:18 +00:00
Родитель 19d6f9b5d1
Коммит 7d2d673683
62 изменённых файлов: 7048 добавлений и 3183 удалений

Просмотреть файл

@ -60,9 +60,9 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus"
rev = "61f399c53a641ebd3077c1f39f054f6d396a633c"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df"]
[source."git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a"]
git = "https://github.com/mozilla/application-services"
rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/audioipc?rev=3495905752a4263827f5d43737f9ca3ed0243ce0"]

42
Cargo.lock сгенерированный
Просмотреть файл

@ -1676,7 +1676,7 @@ dependencies = [
[[package]]
name = "error-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"error-support-macros",
"lazy_static",
@ -1688,7 +1688,7 @@ dependencies = [
[[package]]
name = "error-support-macros"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"proc-macro2",
"quote",
@ -2597,11 +2597,11 @@ dependencies = [
[[package]]
name = "hashlink"
version = "0.8.2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa"
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
dependencies = [
"hashbrown 0.13.999",
"hashbrown 0.14.5",
]
[[package]]
@ -2943,7 +2943,7 @@ dependencies = [
[[package]]
name = "interrupt-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"lazy_static",
"parking_lot",
@ -3283,9 +3283,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
[[package]]
name = "libsqlite3-sys"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"
dependencies = [
"cc",
"pkg-config",
@ -4134,7 +4134,7 @@ dependencies = [
[[package]]
name = "nss_build_common"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
[[package]]
name = "nsstring"
@ -4802,7 +4802,7 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "relevancy"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"anyhow",
"base64 0.21.3",
@ -4825,7 +4825,7 @@ dependencies = [
[[package]]
name = "remote_settings"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"parking_lot",
"serde",
@ -4929,9 +4929,9 @@ dependencies = [
[[package]]
name = "rusqlite"
version = "0.30.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d"
checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae"
dependencies = [
"bitflags 2.5.0",
"fallible-iterator",
@ -5360,7 +5360,7 @@ dependencies = [
[[package]]
name = "sql-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"ffi-support",
"interrupt-support",
@ -5542,7 +5542,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "suggest"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"anyhow",
"chrono",
@ -5591,7 +5591,7 @@ dependencies = [
[[package]]
name = "sync-guid"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"base64 0.21.3",
"rand",
@ -5602,7 +5602,7 @@ dependencies = [
[[package]]
name = "sync15"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"anyhow",
"error-support",
@ -5633,7 +5633,7 @@ dependencies = [
[[package]]
name = "tabs"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"anyhow",
"error-support",
@ -5953,7 +5953,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "types"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"rusqlite",
"serde",
@ -6330,7 +6330,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "viaduct"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"ffi-support",
"log",
@ -6478,7 +6478,7 @@ dependencies = [
[[package]]
name = "webext-storage"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=b09581e8e9b3a946da32d1ad68f8fd732b7a91df#b09581e8e9b3a946da32d1ad68f8fd732b7a91df"
source = "git+https://github.com/mozilla/application-services?rev=3ca067683c7546e34bc8cdbe820fbe8e4089939a#3ca067683c7546e34bc8cdbe820fbe8e4089939a"
dependencies = [
"anyhow",
"error-support",

Просмотреть файл

@ -56,7 +56,7 @@ resolver = "2"
uniffi = "0.27.1"
uniffi_bindgen = "0.27.1"
# Shared across multiple application-services consumers.
rusqlite = "0.30.0"
rusqlite = "0.31.0"
# Explicitly specify what our profiles use. The opt-level setting here is
# a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the
@ -220,14 +220,14 @@ warp = { git = "https://github.com/seanmonstar/warp", rev = "9d081461ae1167eb321
malloc_size_of_derive = { path = "xpcom/rust/malloc_size_of_derive" }
# application-services overrides to make updating them all simpler.
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
relevancy = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "b09581e8e9b3a946da32d1ad68f8fd732b7a91df" }
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
relevancy = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "3ca067683c7546e34bc8cdbe820fbe8e4089939a" }
# Patch mio 0.8.8 to use windows-sys 0.52 (backport https://github.com/tokio-rs/mio/commit/eea9e3e0c469480e5c59c01e6c3c7e5fd88f0848)
mio_0_8 = { package = "mio", git = "https://github.com/glandium/mio", rev = "9a2ef335c366044ffe73b1c4acabe50a1daefe05" }

Просмотреть файл

@ -2244,6 +2244,12 @@ criteria = "safe-to-deploy"
delta = "0.8.1 -> 0.8.2"
notes = "Only dependency changes."
[[audits.hashlink]]
who = "Mark Hammond <mhammond@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.8.1 -> 0.9.1"
notes = "New CursorMut struct and other relatively straight-forward changes."
[[audits.headers]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-run"
@ -2544,6 +2550,11 @@ who = "Mark Hammond <mhammond@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.26.0 -> 0.27.0"
[[audits.libsqlite3-sys]]
who = "Mark Hammond <mhammond@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.27.0 -> 0.28.0"
[[audits.linked-hash-map]]
who = "Aria Beingessner <a.beingessner@gmail.com>"
criteria = "safe-to-deploy"
@ -3565,6 +3576,12 @@ who = "Mark Hammond <mhammond@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.29.0 -> 0.30.0"
[[audits.rusqlite]]
who = "Mark Hammond <mhammond@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.30.0 -> 0.31.0"
notes = "Mostly build and dependency related changes, and bump to sqlite version"
[[audits.rust_cascade]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"

Просмотреть файл

@ -1 +1 @@
{"files":{"CHANGELOG.md":"3479e430ed4bfcd38ac0d9bff95873d8e018e462e0c2dd370a58c282a47caa59","Cargo.toml":"ab72ee61c8eebd28e3904c50b819f13f5be04441b8bfc1fba06607877f94a344","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"e915669a595b11a200873df8286561881b0e04932f6412a585db6297ba0bc97c","README.md":"acc16f95f79df4789a0f116c8748242aac2c17e38ab91d6d5e59c89271ca51e9","src/lib.rs":"12f7bf2e1bdc312fd9740b639983916a2e7a8582c588902af8c4ac71b9032fde","src/linked_hash_map.rs":"cd88b14beac407986d23ea3ab944dd666f62a7a75c99151296b2b1eef54d3569","src/linked_hash_set.rs":"36892b3a9a3388fe2a5454051a691dd38d512771f08a1638ba8322afc65dfe61","src/lru_cache.rs":"d2322af90780a3ef192f25d213f5af38e1dc6492a323fb361757d53692058774","src/serde.rs":"451a34dec0e29d205f997710bf9e733836832f6402e36640f3b6de272a1fd9d4","tests/linked_hash_map.rs":"c2d259c9d0325f4b73268dc686b8cca8fc3c778c757012825a82474026f28634","tests/linked_hash_set.rs":"bfaa3018a99c5c36cf0059bf7836142c2cc69be7f03a8c20bd52131f877e2eec","tests/lru_cache.rs":"c0328001d53e2a0d1ef6fb36550e8cbb989ef1914cef3657f1832b280f4d4572","tests/serde.rs":"4e0b1c19c3c542f0b9adac72f6ff32907da6bb58b4f1810dcdf9cd4e2eef34b1"},"package":"0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa"}
{"files":{"CHANGELOG.md":"73429f4fb76ca1ed2e9a704922c461c915af7dbed3fd00b3f47e0dc0473aabdf","Cargo.toml":"b79146dbfe6bbd2f5b185ae78b89b7e6375f9c7af60b554138f98a97c79b1066","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"e915669a595b11a200873df8286561881b0e04932f6412a585db6297ba0bc97c","README.md":"f2b040b9aa899d3bd9fbb6c2391054980b00e7f475b6066071c17dd59d614d1c","src/lib.rs":"1de536f36f50b780db29d9695970c28ce77677cf2de6a7e27bea148c905b719f","src/linked_hash_map.rs":"512d35320578a9800663438e8985fbd5257c638cacff67cc30c9abd758575f56","src/linked_hash_set.rs":"e67bdbcf0626b2f8b8520691882aa06f8662582b134f81be3f705f0b5434fb7a","src/lru_cache.rs":"0acf965b53536735b8596501d9d72b56f889d7ef9711ea866784ac9a079a4a7d","src/serde.rs":"5b216ccd4b21f3093bb4baf18b9f3943f9ae6f49d2faad2c3b566e8a0cb99851","tests/linked_hash_map.rs":"6089919af984e290d2132f46483a7b7ad100b4bbb35e7295242b129d0345d465","tests/linked_hash_set.rs":"bfaa3018a99c5c36cf0059bf7836142c2cc69be7f03a8c20bd52131f877e2eec","tests/lru_cache.rs":"c0328001d53e2a0d1ef6fb36550e8cbb989ef1914cef3657f1832b280f4d4572","tests/serde.rs":"4e0b1c19c3c542f0b9adac72f6ff32907da6bb58b4f1810dcdf9cd4e2eef34b1"},"package":"6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"}

21
third_party/rust/hashlink/CHANGELOG.md поставляемый
Просмотреть файл

@ -1,3 +1,24 @@
## [0.9.1]
- Bugfix: `LruCache::contains_key` should take `&self` and not move the entry as
though it is accessed.
- Add basic `CursorMut` API to `HashMap` (thanks @olebedev!)
- Bump `hashbrown` dependency to depend on a version of `hashbrown` past a
downstream `zerocopy` dependency.
- Don't depend on default features of `hashbrown`, removes `allocator-api2`
dependency.
## [0.9.0]
- API incompatible change: Don't panic in `reserve` and `try_reserve` in cases
where a rehash is needed. Previously would panic, adds the proper bounds on
reserve methods to do a rehash (previously bounds were missing, and reserve
would result in panics). (Thank you @cuviper!)
## [0.8.4]
- Now builds with `#![no_std]`.
## [0.8.3]
- bump hashbrown to 0.14
## [0.8.2]
- bump hashbrown to 0.13

15
third_party/rust/hashlink/Cargo.toml поставляемый
Просмотреть файл

@ -12,21 +12,30 @@
[package]
edition = "2018"
name = "hashlink"
version = "0.8.2"
version = "0.9.1"
authors = ["kyren <kerriganw@gmail.com>"]
description = "HashMap-like containers that hold their key-value pairs in a user controllable order"
documentation = "https://docs.rs/hashlink"
readme = "README.md"
keywords = ["data-structures"]
keywords = [
"data-structures",
"no_std",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/kyren/hashlink"
[dependencies.hashbrown]
version = "0.13"
version = "0.14.3"
features = [
"ahash",
"inline-more",
]
default-features = false
[dependencies.serde]
version = "1.0"
optional = true
default-features = false
[dev-dependencies.rustc-hash]
version = "1.1"

2
third_party/rust/hashlink/README.md поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
# hashlink -- HashMap-like containers that hold their key-value pairs in a user controllable order
[![Build Status](https://img.shields.io/circleci/project/github/triplehex/hashlink.svg)](https://circleci.com/gh/triplehex/hashlink)
[![Build Status](https://img.shields.io/circleci/project/github/kyren/hashlink.svg)](https://circleci.com/gh/kyren/hashlink)
[![Latest Version](https://img.shields.io/crates/v/hashlink.svg)](https://crates.io/crates/hashlink)
[![API Documentation](https://docs.rs/hashlink/badge.svg)](https://docs.rs/hashlink)

3
third_party/rust/hashlink/src/lib.rs поставляемый
Просмотреть файл

@ -1,3 +1,6 @@
#![no_std]
extern crate alloc;
pub mod linked_hash_map;
pub mod linked_hash_set;
pub mod lru_cache;

Просмотреть файл

@ -1,4 +1,4 @@
use std::{
use core::{
alloc::Layout,
borrow::Borrow,
cmp::Ordering,
@ -11,7 +11,9 @@ use std::{
ptr::{self, NonNull},
};
use hashbrown::{hash_map, HashMap};
use alloc::boxed::Box;
use hashbrown::hash_map::DefaultHashBuilder;
use hashbrown::hash_table::{self, HashTable};
pub enum TryReserveError {
CapacityOverflow,
@ -33,10 +35,10 @@ pub enum TryReserveError {
/// * Methods that have the word `insert` will insert a new entry ot the back of the list, and if
/// that method might replace an entry, that method will *also move that existing entry to the
/// back*.
pub struct LinkedHashMap<K, V, S = hash_map::DefaultHashBuilder> {
map: HashMap<NonNull<Node<K, V>>, (), NullHasher>,
// We need to keep any custom hash builder outside of the HashMap so we can access it alongside
// the entry API without mutable aliasing.
pub struct LinkedHashMap<K, V, S = DefaultHashBuilder> {
table: HashTable<NonNull<Node<K, V>>>,
// We always need to keep our custom hash builder outside of the HashTable, because it doesn't
// know how to do any hashing itself.
hash_builder: S,
// Circular linked list of nodes. If `values` is non-null, it will point to a "guard node"
// which will never have an initialized key or value, `values.prev` will contain the last key /
@ -51,8 +53,8 @@ impl<K, V> LinkedHashMap<K, V> {
#[inline]
pub fn new() -> Self {
Self {
hash_builder: hash_map::DefaultHashBuilder::default(),
map: HashMap::with_hasher(NullHasher),
hash_builder: DefaultHashBuilder::default(),
table: HashTable::new(),
values: None,
free: None,
}
@ -61,8 +63,8 @@ impl<K, V> LinkedHashMap<K, V> {
#[inline]
pub fn with_capacity(capacity: usize) -> Self {
Self {
hash_builder: hash_map::DefaultHashBuilder::default(),
map: HashMap::with_capacity_and_hasher(capacity, NullHasher),
hash_builder: DefaultHashBuilder::default(),
table: HashTable::with_capacity(capacity),
values: None,
free: None,
}
@ -74,7 +76,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
pub fn with_hasher(hash_builder: S) -> Self {
Self {
hash_builder,
map: HashMap::with_hasher(NullHasher),
table: HashTable::new(),
values: None,
free: None,
}
@ -84,30 +86,15 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self {
Self {
hash_builder,
map: HashMap::with_capacity_and_hasher(capacity, NullHasher),
table: HashTable::with_capacity(capacity),
values: None,
free: None,
}
}
#[inline]
pub fn reserve(&mut self, additional: usize) {
self.map.reserve(additional);
}
#[inline]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.map.try_reserve(additional).map_err(|e| match e {
hashbrown::TryReserveError::CapacityOverflow => TryReserveError::CapacityOverflow,
hashbrown::TryReserveError::AllocError { layout } => {
TryReserveError::AllocError { layout }
}
})
}
#[inline]
pub fn len(&self) -> usize {
self.map.len()
self.table.len()
}
#[inline]
@ -117,7 +104,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
#[inline]
pub fn clear(&mut self) {
self.map.clear();
self.table.clear();
if let Some(mut values) = self.values {
unsafe {
drop_value_nodes(values);
@ -182,7 +169,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
};
let len = self.len();
self.map.clear();
self.table.clear();
Drain {
free: (&mut self.free).into(),
@ -246,7 +233,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
cur_free: free,
};
self.map.retain(|&node, _| unsafe {
self.table.retain(|&mut node| unsafe {
let (k, v) = (*node.as_ptr()).entry_mut();
if f(k, v) {
true
@ -264,7 +251,7 @@ impl<K, V, S> LinkedHashMap<K, V, S> {
#[inline]
pub fn capacity(&self) -> usize {
self.map.capacity()
self.table.capacity()
}
}
@ -365,7 +352,7 @@ where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
match self.raw_entry_mut().from_key(&k) {
match self.raw_entry_mut().from_key(k) {
RawEntryMut::Occupied(occupied) => Some(occupied.remove()),
RawEntryMut::Vacant(_) => None,
}
@ -377,7 +364,7 @@ where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
match self.raw_entry_mut().from_key(&k) {
match self.raw_entry_mut().from_key(k) {
RawEntryMut::Occupied(occupied) => Some(occupied.remove_entry()),
RawEntryMut::Vacant(_) => None,
}
@ -390,14 +377,13 @@ where
}
unsafe {
let front = (*self.values.as_ptr()).links.value.next;
match self.map.raw_entry_mut().from_hash(
hash_key(&self.hash_builder, front.as_ref().key_ref()),
|k| (*k).as_ref().key_ref().eq(front.as_ref().key_ref()),
) {
hash_map::RawEntryMut::Occupied(occupied) => {
Some(remove_node(&mut self.free, occupied.remove_entry().0))
}
hash_map::RawEntryMut::Vacant(_) => None,
let hash = hash_node(&self.hash_builder, front);
match self
.raw_entry_mut()
.from_hash(hash, |k| k.eq(front.as_ref().key_ref()))
{
RawEntryMut::Occupied(occupied) => Some(occupied.remove_entry()),
RawEntryMut::Vacant(_) => None,
}
}
}
@ -409,16 +395,13 @@ where
}
unsafe {
let back = (*self.values.as_ptr()).links.value.prev;
let hash = hash_node(&self.hash_builder, back);
match self
.map
.raw_entry_mut()
.from_hash(hash_key(&self.hash_builder, back.as_ref().key_ref()), |k| {
(*k).as_ref().key_ref().eq(back.as_ref().key_ref())
}) {
hash_map::RawEntryMut::Occupied(occupied) => {
Some(remove_node(&mut self.free, occupied.remove_entry().0))
}
hash_map::RawEntryMut::Vacant(_) => None,
.from_hash(hash, |k| k.eq(back.as_ref().key_ref()))
{
RawEntryMut::Occupied(occupied) => Some(occupied.remove_entry()),
RawEntryMut::Vacant(_) => None,
}
}
}
@ -458,37 +441,32 @@ where
}
#[inline]
pub fn shrink_to_fit(&mut self) {
unsafe {
let len = self.map.len();
if len != self.map.capacity() {
self.map = HashMap::with_hasher(NullHasher);
self.map.reserve(len);
if let Some(guard) = self.values {
let mut cur = guard.as_ref().links.value.next;
while cur != guard {
let hash = hash_key(&self.hash_builder, cur.as_ref().key_ref());
match self
.map
.raw_entry_mut()
.from_hash(hash, |k| (*k).as_ref().key_ref().eq(cur.as_ref().key_ref()))
{
hash_map::RawEntryMut::Occupied(_) => unreachable!(),
hash_map::RawEntryMut::Vacant(vacant) => {
pub fn reserve(&mut self, additional: usize) {
let hash_builder = &self.hash_builder;
vacant.insert_with_hasher(hash, cur, (), |k| {
hash_key(hash_builder, (*k).as_ref().key_ref())
});
}
}
cur = cur.as_ref().links.value.next;
}
}
self.table
.reserve(additional, move |&n| unsafe { hash_node(hash_builder, n) });
}
drop_free_nodes(self.free);
self.free = None;
#[inline]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
let hash_builder = &self.hash_builder;
self.table
.try_reserve(additional, move |&n| unsafe { hash_node(hash_builder, n) })
.map_err(|e| match e {
hashbrown::TryReserveError::CapacityOverflow => TryReserveError::CapacityOverflow,
hashbrown::TryReserveError::AllocError { layout } => {
TryReserveError::AllocError { layout }
}
})
}
#[inline]
pub fn shrink_to_fit(&mut self) {
let hash_builder = &self.hash_builder;
unsafe {
self.table
.shrink_to_fit(move |&n| hash_node(hash_builder, n));
drop_free_nodes(self.free.take());
}
}
@ -514,23 +492,51 @@ where
if filter {
let k = (*cur.as_ptr()).key_ref();
let hash = hash_key(&self.hash_builder, k);
match self
.map
.raw_entry_mut()
.from_hash(hash, |o| (*o).as_ref().key_ref().eq(k))
{
hash_map::RawEntryMut::Occupied(entry) => {
entry.remove();
self.table
.find_entry(hash, |o| (*o).as_ref().key_ref().eq(k))
.unwrap()
.remove();
drop_filtered_values.drop_later(cur);
}
hash_map::RawEntryMut::Vacant(_) => unreachable!(),
}
}
cur = next;
}
}
}
}
// Returns the `CursorMut` over the _guard_ node.
fn cursor_mut(&mut self) -> CursorMut<K, V, S> {
unsafe { ensure_guard_node(&mut self.values) };
CursorMut {
cur: self.values.as_ptr(),
hash_builder: &self.hash_builder,
free: &mut self.free,
values: &mut self.values,
table: &mut self.table,
}
}
/// Returns the `CursorMut` over the front node.
///
/// Note: The `CursorMut` is pointing to the _guard_ node in an empty `LinkedHashMap` and
/// will always return `None` as its current element, regardless of any move in any
/// direction.
pub fn cursor_front_mut(&mut self) -> CursorMut<K, V, S> {
let mut c = self.cursor_mut();
c.move_next();
c
}
/// Returns the `CursorMut` over the back node.
///
/// Note: The `CursorMut` is pointing to the _guard_ node in an empty `LinkedHashMap` and
/// will always return `None` as its current element, regardless of any move in any
/// direction.
pub fn cursor_back_mut(&mut self) -> CursorMut<K, V, S> {
let mut c = self.cursor_mut();
c.move_prev();
c
}
}
impl<K, V, S> LinkedHashMap<K, V, S>
@ -539,20 +545,12 @@ where
{
#[inline]
pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S> {
RawEntryBuilder {
hash_builder: &self.hash_builder,
entry: self.map.raw_entry(),
}
RawEntryBuilder { map: self }
}
#[inline]
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S> {
RawEntryBuilderMut {
hash_builder: &self.hash_builder,
values: &mut self.values,
free: &mut self.free,
entry: self.map.raw_entry_mut(),
}
RawEntryBuilderMut { map: self }
}
}
@ -716,7 +714,7 @@ where
}
pub enum Entry<'a, K, V, S> {
Occupied(OccupiedEntry<'a, K, V>),
Occupied(OccupiedEntry<'a, K, V, S>),
Vacant(VacantEntry<'a, K, V, S>),
}
@ -791,12 +789,12 @@ impl<'a, K, V, S> Entry<'a, K, V, S> {
}
}
pub struct OccupiedEntry<'a, K, V> {
pub struct OccupiedEntry<'a, K, V, S> {
key: K,
raw_entry: RawOccupiedEntryMut<'a, K, V>,
raw_entry: RawOccupiedEntryMut<'a, K, V, S>,
}
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for OccupiedEntry<'_, K, V> {
impl<K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for OccupiedEntry<'_, K, V, S> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry")
@ -806,7 +804,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for OccupiedEntry<'_, K, V> {
}
}
impl<'a, K, V> OccupiedEntry<'a, K, V> {
impl<'a, K, V, S> OccupiedEntry<'a, K, V, S> {
#[inline]
pub fn key(&self) -> &K {
self.raw_entry.key()
@ -865,6 +863,16 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
self.replace_entry(value)
}
/// Returns a `CursorMut` over the current entry.
#[inline]
pub fn cursor_mut(self) -> CursorMut<'a, K, V, S>
where
K: Eq + Hash,
S: BuildHasher,
{
self.raw_entry.cursor_mut()
}
/// Replaces the entry's key with the key provided to `LinkedHashMap::entry`, and replaces the
/// entry's value with the given `value` parameter.
///
@ -920,8 +928,7 @@ impl<'a, K, V, S> VacantEntry<'a, K, V, S> {
}
pub struct RawEntryBuilder<'a, K, V, S> {
hash_builder: &'a S,
entry: hash_map::RawEntryBuilder<'a, NonNull<Node<K, V>>, (), NullHasher>,
map: &'a LinkedHashMap<K, V, S>,
}
impl<'a, K, V, S> RawEntryBuilder<'a, K, V, S>
@ -934,7 +941,7 @@ where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
let hash = hash_key(self.hash_builder, k);
let hash = hash_key(&self.map.hash_builder, k);
self.from_key_hashed_nocheck(hash, k)
}
@ -954,10 +961,10 @@ where
mut is_match: impl FnMut(&K) -> bool,
) -> Option<(&'a K, &'a V)> {
unsafe {
let node = *self
.entry
.from_hash(hash, move |k| is_match((*k).as_ref().key_ref()))?
.0;
let node = self
.map
.table
.find(hash, move |k| is_match((*k).as_ref().key_ref()))?;
let (key, value) = (*node.as_ptr()).entry_ref();
Some((key, value))
@ -982,10 +989,7 @@ where
}
pub struct RawEntryBuilderMut<'a, K, V, S> {
hash_builder: &'a S,
values: &'a mut Option<NonNull<Node<K, V>>>,
free: &'a mut Option<NonNull<Node<K, V>>>,
entry: hash_map::RawEntryBuilderMut<'a, NonNull<Node<K, V>>, (), NullHasher>,
map: &'a mut LinkedHashMap<K, V, S>,
}
impl<'a, K, V, S> RawEntryBuilderMut<'a, K, V, S>
@ -998,7 +1002,7 @@ where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
let hash = hash_key(self.hash_builder, k);
let hash = hash_key(&self.map.hash_builder, k);
self.from_key_hashed_nocheck(hash, k)
}
@ -1018,22 +1022,22 @@ where
mut is_match: impl FnMut(&K) -> bool,
) -> RawEntryMut<'a, K, V, S> {
let entry = self
.entry
.from_hash(hash, move |k| is_match(unsafe { (*k).as_ref().key_ref() }));
.map
.table
.find_entry(hash, move |k| is_match(unsafe { (*k).as_ref().key_ref() }));
match entry {
hash_map::RawEntryMut::Occupied(occupied) => {
RawEntryMut::Occupied(RawOccupiedEntryMut {
free: self.free,
values: self.values,
Ok(occupied) => RawEntryMut::Occupied(RawOccupiedEntryMut {
hash_builder: &self.map.hash_builder,
free: &mut self.map.free,
values: &mut self.map.values,
entry: occupied,
})
}
hash_map::RawEntryMut::Vacant(vacant) => RawEntryMut::Vacant(RawVacantEntryMut {
hash_builder: self.hash_builder,
values: self.values,
free: self.free,
entry: vacant,
}),
Err(absent) => RawEntryMut::Vacant(RawVacantEntryMut {
hash_builder: &self.map.hash_builder,
values: &mut self.map.values,
free: &mut self.map.free,
entry: absent,
}),
}
}
@ -1056,7 +1060,7 @@ where
}
pub enum RawEntryMut<'a, K, V, S> {
Occupied(RawOccupiedEntryMut<'a, K, V>),
Occupied(RawOccupiedEntryMut<'a, K, V, S>),
Vacant(RawVacantEntryMut<'a, K, V, S>),
}
@ -1117,13 +1121,14 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
}
}
pub struct RawOccupiedEntryMut<'a, K, V> {
pub struct RawOccupiedEntryMut<'a, K, V, S> {
hash_builder: &'a S,
free: &'a mut Option<NonNull<Node<K, V>>>,
values: &'a mut Option<NonNull<Node<K, V>>>,
entry: hash_map::RawOccupiedEntryMut<'a, NonNull<Node<K, V>>, (), NullHasher>,
entry: hash_table::OccupiedEntry<'a, NonNull<Node<K, V>>>,
}
impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
#[inline]
pub fn key(&self) -> &K {
self.get_key_value().0
@ -1157,7 +1162,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn get_key_value(&self) -> (&K, &V) {
unsafe {
let node = *self.entry.key();
let node = *self.entry.get();
let (key, value) = (*node.as_ptr()).entry_ref();
(key, value)
}
@ -1166,7 +1171,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn get_key_value_mut(&mut self) -> (&mut K, &mut V) {
unsafe {
let node = *self.entry.key_mut();
let node = *self.entry.get_mut();
let (key, value) = (*node.as_ptr()).entry_mut();
(key, value)
}
@ -1175,7 +1180,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn into_key_value(self) -> (&'a mut K, &'a mut V) {
unsafe {
let node = *self.entry.into_key();
let node = *self.entry.into_mut();
let (key, value) = (*node.as_ptr()).entry_mut();
(key, value)
}
@ -1184,7 +1189,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn to_back(&mut self) {
unsafe {
let node = *self.entry.key_mut();
let node = *self.entry.get_mut();
detach_node(node);
attach_before(node, NonNull::new_unchecked(self.values.as_ptr()));
}
@ -1193,7 +1198,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn to_front(&mut self) {
unsafe {
let node = *self.entry.key_mut();
let node = *self.entry.get_mut();
detach_node(node);
attach_before(node, (*self.values.as_ptr()).links.value.next);
}
@ -1202,7 +1207,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn replace_value(&mut self, value: V) -> V {
unsafe {
let mut node = *self.entry.key_mut();
let mut node = *self.entry.get_mut();
mem::replace(&mut node.as_mut().entry_mut().1, value)
}
}
@ -1210,7 +1215,7 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn replace_key(&mut self, key: K) -> K {
unsafe {
let mut node = *self.entry.key_mut();
let mut node = *self.entry.get_mut();
mem::replace(&mut node.as_mut().entry_mut().0, key)
}
}
@ -1222,16 +1227,32 @@ impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
#[inline]
pub fn remove_entry(self) -> (K, V) {
let node = self.entry.remove_entry().0;
let node = self.entry.remove().0;
unsafe { remove_node(self.free, node) }
}
/// Returns a `CursorMut` over the current entry.
#[inline]
pub fn cursor_mut(self) -> CursorMut<'a, K, V, S>
where
K: Eq + Hash,
S: BuildHasher,
{
CursorMut {
cur: self.entry.get().as_ptr(),
hash_builder: self.hash_builder,
free: self.free,
values: self.values,
table: self.entry.into_table(),
}
}
}
pub struct RawVacantEntryMut<'a, K, V, S> {
hash_builder: &'a S,
values: &'a mut Option<NonNull<Node<K, V>>>,
free: &'a mut Option<NonNull<Node<K, V>>>,
entry: hash_map::RawVacantEntryMut<'a, NonNull<Node<K, V>>, (), NullHasher>,
entry: hash_table::AbsentEntry<'a, NonNull<Node<K, V>>>,
}
impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
@ -1272,10 +1293,11 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
new_node.as_mut().put_entry((key, value));
attach_before(new_node, NonNull::new_unchecked(self.values.as_ptr()));
let node = *self
let node = self
.entry
.insert_with_hasher(hash, new_node, (), move |k| hasher((*k).as_ref().key_ref()))
.0;
.into_table()
.insert_unique(hash, new_node, move |k| hasher((*k).as_ref().key_ref()))
.into_mut();
let (key, value) = (*node.as_ptr()).entry_mut();
(key, value)
@ -1300,7 +1322,7 @@ impl<K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for RawEntryMut<'_, K, V, S> {
}
}
impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RawOccupiedEntryMut<'_, K, V> {
impl<K: fmt::Debug, V: fmt::Debug, S> fmt::Debug for RawOccupiedEntryMut<'_, K, V, S> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawOccupiedEntryMut")
@ -1324,17 +1346,19 @@ impl<K, V, S> fmt::Debug for RawEntryBuilder<'_, K, V, S> {
}
}
unsafe impl<'a, K, V> Send for RawOccupiedEntryMut<'a, K, V>
unsafe impl<'a, K, V, S> Send for RawOccupiedEntryMut<'a, K, V, S>
where
K: Send,
V: Send,
S: Send,
{
}
unsafe impl<'a, K, V> Sync for RawOccupiedEntryMut<'a, K, V>
unsafe impl<'a, K, V, S> Sync for RawOccupiedEntryMut<'a, K, V, S>
where
K: Sync,
V: Sync,
S: Sync,
{
}
@ -1717,6 +1741,168 @@ impl<'a, K, V> Drop for Drain<'a, K, V> {
}
}
/// The `CursorMut` struct and its implementation provide the basic mutable Cursor API for Linked
/// lists as proposed in
/// [here](https://github.com/rust-lang/rfcs/blob/master/text/2570-linked-list-cursors.md), with
/// several exceptions:
///
/// - It behaves similarly to Rust's Iterators, returning `None` when the end of the list is
/// reached. A _guard_ node is positioned between the head and tail of the linked list to
/// facilitate this. If the cursor is over this guard node, `None` is returned, signaling the end
/// or start of the list. From this position, the cursor can move in either direction as the
/// linked list is circular, with the guard node connecting the two ends.
/// - The current implementation does not include an `index` method, as it does not track the index
/// of its elements. It provides access to each map entry as a tuple of `(&K, &mut V)`.
///
pub struct CursorMut<'a, K, V, S> {
cur: *mut Node<K, V>,
hash_builder: &'a S,
free: &'a mut Option<NonNull<Node<K, V>>>,
values: &'a mut Option<NonNull<Node<K, V>>>,
table: &'a mut hashbrown::HashTable<NonNull<Node<K, V>>>,
}
impl<'a, K, V, S> CursorMut<'a, K, V, S> {
/// Returns an `Option` of the current element in the list, provided it is not the
/// _guard_ node, and `None` overwise.
#[inline]
pub fn current(&mut self) -> Option<(&K, &mut V)> {
unsafe {
let at = NonNull::new_unchecked(self.cur);
self.peek(at)
}
}
/// Retrieves the next element in the list (moving towards the end).
#[inline]
pub fn peek_next(&mut self) -> Option<(&K, &mut V)> {
unsafe {
let at = (*self.cur).links.value.next;
self.peek(at)
}
}
/// Retrieves the previous element in the list (moving towards the front).
#[inline]
pub fn peek_prev(&mut self) -> Option<(&K, &mut V)> {
unsafe {
let at = (*self.cur).links.value.prev;
self.peek(at)
}
}
// Retrieves the element without advancing current position to it.
#[inline]
fn peek(&mut self, at: NonNull<Node<K, V>>) -> Option<(&K, &mut V)> {
if let Some(values) = self.values {
unsafe {
let node = at.as_ptr();
if node == values.as_ptr() {
None
} else {
let entry = (*node).entry_mut();
Some((&entry.0, &mut entry.1))
}
}
} else {
None
}
}
/// Updates the pointer to the current element to the next element in the
/// list (that is, moving towards the end).
#[inline]
pub fn move_next(&mut self) {
let at = unsafe { (*self.cur).links.value.next };
self.muv(at);
}
/// Updates the pointer to the current element to the previous element in the
/// list (that is, moving towards the front).
#[inline]
pub fn move_prev(&mut self) {
let at = unsafe { (*self.cur).links.value.prev };
self.muv(at);
}
// Updates the pointer to the current element to the one returned by the at closure function.
#[inline]
fn muv(&mut self, at: NonNull<Node<K, V>>) {
self.cur = at.as_ptr();
}
/// Inserts the provided key and value before the current element. It checks if an entry
/// with the given key exists and, if so, replaces its value with the provided `key`
/// parameter. The key is not updated; this matters for types that can be `==` without
/// being identical.
///
/// If the entry doesn't exist, it creates a new one. If a value has been updated, the
/// function returns the *old* value wrapped with `Some` and `None` otherwise.
#[inline]
pub fn insert_before(&mut self, key: K, value: V) -> Option<V>
where
K: Eq + Hash,
S: BuildHasher,
{
let before = unsafe { NonNull::new_unchecked(self.cur) };
self.insert(key, value, before)
}
/// Inserts the provided key and value after the current element. It checks if an entry
/// with the given key exists and, if so, replaces its value with the provided `key`
/// parameter. The key is not updated; this matters for types that can be `==` without
/// being identical.
///
/// If the entry doesn't exist, it creates a new one. If a value has been updated, the
/// function returns the *old* value wrapped with `Some` and `None` otherwise.
#[inline]
pub fn insert_after(&mut self, key: K, value: V) -> Option<V>
where
K: Eq + Hash,
S: BuildHasher,
{
let before = unsafe { (*self.cur).links.value.next };
self.insert(key, value, before)
}
// Inserts an element immediately before the given `before` node.
#[inline]
fn insert(&mut self, key: K, value: V, before: NonNull<Node<K, V>>) -> Option<V>
where
K: Eq + Hash,
S: BuildHasher,
{
unsafe {
let hash = hash_key(self.hash_builder, &key);
let i_entry = self
.table
.find_entry(hash, |o| (*o).as_ref().key_ref().eq(&key));
match i_entry {
Ok(occupied) => {
let mut node = *occupied.into_mut();
let pv = mem::replace(&mut node.as_mut().entry_mut().1, value);
if node != before {
detach_node(node);
attach_before(node, before);
}
Some(pv)
}
Err(_) => {
let mut new_node = allocate_node(self.free);
new_node.as_mut().put_entry((key, value));
attach_before(new_node, before);
let hash_builder = self.hash_builder;
self.table.insert_unique(hash, new_node, move |k| {
hash_key(hash_builder, (*k).as_ref().key_ref())
});
None
}
}
}
}
}
pub struct Keys<'a, K, V> {
inner: Iter<'a, K, V>,
}
@ -1898,10 +2084,9 @@ impl<K, V, S> IntoIterator for LinkedHashMap<K, V, S> {
};
let len = self.len();
drop_free_nodes(self.free);
self.free = None;
drop_free_nodes(self.free.take());
self.map.clear();
self.table.clear();
IntoIter {
head,
@ -1913,30 +2098,6 @@ impl<K, V, S> IntoIterator for LinkedHashMap<K, V, S> {
}
}
// A ZST that asserts that the inner HashMap will not do its own key hashing
struct NullHasher;
impl BuildHasher for NullHasher {
type Hasher = Self;
#[inline]
fn build_hasher(&self) -> Self {
Self
}
}
impl Hasher for NullHasher {
#[inline]
fn write(&mut self, _bytes: &[u8]) {
unreachable!("inner map should not be using its built-in hasher")
}
#[inline]
fn finish(&self) -> u64 {
unreachable!("inner map should not be using its built-in hasher")
}
}
struct ValueLinks<K, V> {
next: NonNull<Node<K, V>>,
prev: NonNull<Node<K, V>>,
@ -1945,10 +2106,7 @@ struct ValueLinks<K, V> {
impl<K, V> Clone for ValueLinks<K, V> {
#[inline]
fn clone(&self) -> Self {
ValueLinks {
next: self.next,
prev: self.prev,
}
*self
}
}
@ -1961,7 +2119,7 @@ struct FreeLink<K, V> {
impl<K, V> Clone for FreeLink<K, V> {
#[inline]
fn clone(&self) -> Self {
FreeLink { next: self.next }
*self
}
}
@ -2131,6 +2289,15 @@ unsafe fn remove_node<K, V>(
node.as_mut().take_entry()
}
#[inline]
unsafe fn hash_node<S, K, V>(s: &S, node: NonNull<Node<K, V>>) -> u64
where
S: BuildHasher,
K: Hash,
{
hash_key(s, node.as_ref().key_ref())
}
#[inline]
fn hash_key<S, Q>(s: &S, k: &Q) -> u64
where

Просмотреть файл

@ -1,4 +1,4 @@
use std::{
use core::{
borrow::Borrow,
fmt,
hash::{BuildHasher, Hash, Hasher},

6
third_party/rust/hashlink/src/lru_cache.rs поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
use std::{
use core::{
borrow::Borrow,
fmt,
hash::{BuildHasher, Hash},
@ -87,12 +87,12 @@ where
S: BuildHasher,
{
#[inline]
pub fn contains_key<Q>(&mut self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
self.get_mut(key).is_some()
self.map.contains_key(key)
}
/// Insert a new value into the `LruCache`.

2
third_party/rust/hashlink/src/serde.rs поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
use std::{
use core::{
fmt::{self, Formatter},
hash::{BuildHasher, Hash},
marker::PhantomData,

Просмотреть файл

@ -541,6 +541,20 @@ fn test_replace() {
.eq([(1, 1), (2, 6), (4, 4), (3, 5)].iter().copied()));
}
#[test]
fn test_reserve() {
let mut map = LinkedHashMap::new();
map.insert(1, 1);
map.insert(2, 2);
map.insert(3, 3);
map.insert(4, 4);
assert!(map.capacity() - map.len() < 100);
map.reserve(100);
assert!(map.capacity() - map.len() >= 100);
}
#[test]
fn test_shrink_to_fit_resize() {
let mut map = LinkedHashMap::new();
@ -561,3 +575,248 @@ fn test_shrink_to_fit_resize() {
assert_eq!(map.get(&i).unwrap(), &i);
}
}
#[test]
fn test_cursor_mut_current() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
let value = cursor.current().unwrap();
assert_eq!(value, (&3, &mut 3));
*value.1 = 5;
let value = cursor.current().unwrap();
assert_eq!(value, (&3, &mut 5));
}
}
#[test]
fn test_cursor_mut_move_next() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
map.insert(4, 4);
map.insert(5, 5);
map.insert(6, 6);
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 3);
cursor.move_next();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 4);
cursor.move_next();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 5);
cursor.move_next();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 6);
cursor.move_next();
let value = cursor.current();
assert!(value.is_none());
cursor.move_next();
let value = cursor.current();
assert!(value.is_some());
assert_eq!(value.unwrap().1, &mut 3);
cursor.move_next();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 4);
}
}
#[test]
fn test_cursor_mut_move_prev() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
cursor.move_prev();
let value = cursor.current();
assert!(value.is_none());
cursor.move_prev();
let value = cursor.current();
assert!(&value.is_some());
assert_eq!(value.unwrap().1, &mut 3);
}
}
#[test]
fn test_cursor_mut_pick_next() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
map.insert(4, 4);
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
let next = cursor.peek_next();
assert!(&next.is_some());
assert_eq!(next.unwrap().1, &mut 4);
cursor.move_next();
let next = cursor.peek_next();
assert!(&next.is_none());
cursor.move_next();
let next = cursor.peek_next();
assert!(&next.is_some());
let value = next.as_ref().unwrap().to_owned();
assert_eq!(*value.1, 3);
*next.unwrap().1 = 5;
let next = cursor.peek_next();
assert!(&next.is_some());
assert_eq!(next.unwrap().1, &mut 5);
}
}
#[test]
fn test_cursor_mut_pick_prev() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
map.insert(4, 4);
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
let next = cursor.peek_prev();
assert!(&next.is_none());
cursor.move_prev();
let next = cursor.peek_prev();
assert!(&next.is_some());
assert_eq!(next.unwrap(), (&4, &mut 4));
}
}
#[test]
fn test_cursor_mut_insert_before() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
map.insert(4, 4);
// Insert new element in the middle
if let linked_hash_map::Entry::Occupied(entry) = map.entry(4) {
entry.cursor_mut().insert_before(5, 5);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(3, 3), (5, 5), (4, 4)].iter().copied()));
}
// Insert new element at the very end of the list
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
let mut cursor = entry.cursor_mut();
cursor.move_prev();
cursor.insert_before(6, 6);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(3, 3), (5, 5), (4, 4), (6, 6)].iter().copied()));
}
// Relocate element and override value
if let linked_hash_map::Entry::Occupied(entry) = map.entry(5) {
entry.cursor_mut().insert_before(4, 42);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(3, 3), (4, 42), (5, 5), (6, 6)].iter().copied()));
}
}
#[test]
fn test_cursor_mut_insert_after() {
let mut map = LinkedHashMap::new();
map.insert(3, 3);
map.insert(4, 4);
// Insert new element in the middle.
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
entry.cursor_mut().insert_after(5, 5);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(3, 3), (5, 5), (4, 4)].iter().copied()));
}
// Insert new element as the first one.
if let linked_hash_map::Entry::Occupied(entry) = map.entry(4) {
let mut cursor = entry.cursor_mut();
cursor.move_next();
cursor.insert_after(6, 6);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(6, 6), (3, 3), (5, 5), (4, 4)].iter().copied()));
}
}
#[test]
fn test_cursor_mut_insert_before_itself() {
let mut map = LinkedHashMap::new();
map.insert(2, 2);
map.insert(3, 3);
map.insert(4, 4);
// Insert a new value before its key. This is a corner case that needs to be
// handled explicitly.
if let linked_hash_map::Entry::Occupied(entry) = map.entry(3) {
entry.cursor_mut().insert_before(3, 5);
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(2, 2), (3, 5), (4, 4)].iter().copied()));
}
}
#[test]
fn test_cursor_front_mut() {
let mut map: LinkedHashMap<i32, i32> = LinkedHashMap::new();
// The `CursorMut`` in an empty LinkedHashMap will always return `None` as its
// current element, regardless of any move in any direction.
let mut cursor = map.cursor_front_mut();
assert!(cursor.current().is_none());
cursor.move_next();
assert!(cursor.current().is_none());
cursor.insert_after(1, 1);
cursor.move_next();
assert!(cursor.current().is_some());
assert_eq!(cursor.current().unwrap().1, &mut 1);
cursor.move_next();
assert!(cursor.current().is_none());
assert!(map
.iter()
.map(|(k, v)| (*k, *v))
.eq([(1, 1)].iter().copied()));
map.insert(2, 2);
map.insert(3, 3);
let mut cursor = map.cursor_front_mut();
assert!(cursor.current().is_some());
assert_eq!(cursor.current().unwrap().1, &mut 1);
}
#[test]
fn test_cursor_back_mut() {
let mut map: LinkedHashMap<i32, i32> = LinkedHashMap::new();
map.insert(1, 1);
map.insert(2, 2);
map.insert(3, 3);
let mut cursor = map.cursor_back_mut();
assert!(cursor.current().is_some());
assert_eq!(cursor.current().unwrap().1, &mut 3);
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"f31bc542c5a3e5dfe82a7c62fa4a0a3e5b56424b77eb7ad913aa322e5e070c60","README.md":"7f1418b4a7c138ba20bcaea077fe6cf0d6ffbaf6df6b90c80efc52aa0d0e2e9f","build.rs":"49840f26c73c5db19cb4e7f02930e49d7a19648168b83f2313ac1a0303c103df","src/error.rs":"b83cbe8abd22a9d687508d236a2a77e28b3fc6c39673633e5820cc0e3fc86cba","src/interrupt_support.udl":"31181937f89dbc229837484dec47a228955bb1b6c47d3b049d91f23cbe7dc069","src/interruptee.rs":"c56f9ac610d0b24a128a907266432287558c4b73f6c24b82674ca7894181d18f","src/lib.rs":"cf44a84310913be5264e1c4a3e004a9f7a6cd82d01a109bb6ac4d6002b5dd560","src/shutdown.rs":"e4b7a89f1ef319646aee3282a0d60465c3dbf571c52a0295f3b1a8909f345818","src/sql.rs":"db9b93fb2fe813ae0af6313082f07fad0e381691290466a7ac67bec14024722d"},"package":null}
{"files":{"Cargo.toml":"eb30cf4d9a37bc842d15266d4cf648c8b435653fe91599ca42954880f6304589","README.md":"7f1418b4a7c138ba20bcaea077fe6cf0d6ffbaf6df6b90c80efc52aa0d0e2e9f","build.rs":"49840f26c73c5db19cb4e7f02930e49d7a19648168b83f2313ac1a0303c103df","src/error.rs":"b83cbe8abd22a9d687508d236a2a77e28b3fc6c39673633e5820cc0e3fc86cba","src/interrupt_support.udl":"31181937f89dbc229837484dec47a228955bb1b6c47d3b049d91f23cbe7dc069","src/interruptee.rs":"c56f9ac610d0b24a128a907266432287558c4b73f6c24b82674ca7894181d18f","src/lib.rs":"cf44a84310913be5264e1c4a3e004a9f7a6cd82d01a109bb6ac4d6002b5dd560","src/shutdown.rs":"e4b7a89f1ef319646aee3282a0d60465c3dbf571c52a0295f3b1a8909f345818","src/sql.rs":"db9b93fb2fe813ae0af6313082f07fad0e381691290466a7ac67bec14024722d"},"package":null}

Просмотреть файл

@ -23,7 +23,7 @@ parking_lot = ">=0.11,<=0.12"
uniffi = "0.27.1"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"functions",
"limits",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"19eb105a387dc88e701018ca00da996ca603f881917e3d296dac987963b6f286","LICENSE":"f59ba65550f2a5adff98ec6478d783402c8e0a3eb515025c0b3438f3d30dc39e","README.md":"3ee43dc667cbc03092311fa1ad8c9baa8fee82a6afc11289cfa0d4b1d8cc173e","Upgrade.md":"d151a67d4bbb1a5a300d084d210d6cd238d833a6d4bd5d958ae7469a9deccb36","bindgen-bindings/bindgen_3.14.0.rs":"21074ddbc5ef6bb7fb7c04ef48c730a2b074b9d695c93c685cf01f870248844b","bindgen-bindings/bindgen_3.14.0_ext.rs":"2988b5f0670d7862166d3820b8a176d3da329b6105567e66e45aafb17d736fa6","build.rs":"c05d6fbd288a57bc529a85edeaa285359896802a4ce8dbdfee941fe66a247c48","sqlcipher/LICENSE":"ea4fcb309f14a22065e1ea45362d494d320012249ed865fe9c7c0946db754131","sqlcipher/bindgen_bundled_version.rs":"b90cdb889a74ce82af24a78932979c59df4d9dbb31228d05e6574a2fd852d0ba","sqlcipher/sqlite3.c":"2dc94cbc5f013078ad7e48b65fe1c63cb79b4d25aba9ccaef1699724ae6640f7","sqlcipher/sqlite3.h":"46bf1085dbe8063fe002f667a4ff9cf953ae7896d2893cdfb7be47260b2489cd","sqlcipher/sqlite3ext.h":"7f9ae3bab94bbc62d909fbb0149861b4a0832299f12d7ccbfecc7f28a8d27aa2","sqlite3/bindgen_bundled_version.rs":"df27f70e4b8b50aa521815cc5f514a6a8f20047fd85d04c656829ee1f1b3de58","sqlite3/bindgen_bundled_version_ext.rs":"59dcc604ce53c31121a9857e0e6f8ca0a6b4e86339468556aaad409cb2c2fb77","sqlite3/sqlite3.c":"7b31410f2e3bb48be92d6c4ba6450034a9bd314c99ae9f9a06327091f005668c","sqlite3/sqlite3.h":"9e2f65a6607545b278ab2cb520d93aec977aee0e19dc374d51b18300507ed20f","sqlite3/sqlite3ext.h":"b184dd1586d935133d37ad76fa353faf0a1021ff2fdedeedcc3498fff74bbb94","sqlite3/wasm32-wasi-vfs.c":"b95842044da2b8777876b7d3fef8c9711e8c201fb4a4255dbac98729a456bb5d","src/error.rs":"73ce88d90e3d5a99fc4fdc146fe5405e7d9cdcc5334eb4f0f53e0919c9b19c05","src/lib.rs":"b85a07e8cfe221df01cd890729c7fda84904e202ff916124ba83b16181da90e0","upgrade.sh":"aafa7a36b0ebe0c0cb6cb65e0e6b2d77b77d9b58d9e7317756b1861040cf2a4b","upgrade_sqlcipher.sh":"0372ba89bb41427c2c2010a3d41f1363d77eb73bbfecc2fde20aae8499a42a21","wrapper.h":"652f14b2bcbc7a7b32d11365afa513b0977a3dc0a800dfde4cb85b3e23baf3b3","wrapper_ext.h":"fa7a53fea99318ee29d75e6d5fab4d7ed26e9599803268e6a24396265f2a6f3a"},"package":"cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"}
{"files":{"Cargo.toml":"70d74c9e4358952e69e2d5d4b7e948dc39139ee70c6d9d0cb8baa7be8e7c5abf","LICENSE":"f59ba65550f2a5adff98ec6478d783402c8e0a3eb515025c0b3438f3d30dc39e","README.md":"6f31c834d526983cefa4d762430262eba52c45419751bd8a6cca9d943fd3eac9","Upgrade.md":"d151a67d4bbb1a5a300d084d210d6cd238d833a6d4bd5d958ae7469a9deccb36","bindgen-bindings/bindgen_3.14.0.rs":"21074ddbc5ef6bb7fb7c04ef48c730a2b074b9d695c93c685cf01f870248844b","bindgen-bindings/bindgen_3.14.0_ext.rs":"2988b5f0670d7862166d3820b8a176d3da329b6105567e66e45aafb17d736fa6","build.rs":"a3a0c7f409e20573d21448fb53c5a1f168fd04c5983af68671da126cc3bf9ff4","sqlcipher/LICENSE":"ea4fcb309f14a22065e1ea45362d494d320012249ed865fe9c7c0946db754131","sqlcipher/bindgen_bundled_version.rs":"b90cdb889a74ce82af24a78932979c59df4d9dbb31228d05e6574a2fd852d0ba","sqlcipher/sqlite3.c":"2dc94cbc5f013078ad7e48b65fe1c63cb79b4d25aba9ccaef1699724ae6640f7","sqlcipher/sqlite3.h":"46bf1085dbe8063fe002f667a4ff9cf953ae7896d2893cdfb7be47260b2489cd","sqlcipher/sqlite3ext.h":"7f9ae3bab94bbc62d909fbb0149861b4a0832299f12d7ccbfecc7f28a8d27aa2","sqlite3/bindgen_bundled_version.rs":"3dda83bd41376847eb3e0fd9e4aa645e6f5b48ebdc5227df051c044ebdce177a","sqlite3/bindgen_bundled_version_ext.rs":"73b54ea41acf310e13555ec925d5eaee6443d0787e6b1e4310f83647967a1a04","sqlite3/sqlite3.c":"7956a38f236a6be6c0bb30c96ba4f85f19e5a69f6beb6d2c62c9d246972a6775","sqlite3/sqlite3.h":"0c207567adc631521a353e067cfbc5044ebf11868f3c3fbf3178d6990409740e","sqlite3/sqlite3ext.h":"b184dd1586d935133d37ad76fa353faf0a1021ff2fdedeedcc3498fff74bbb94","sqlite3/wasm32-wasi-vfs.c":"b95842044da2b8777876b7d3fef8c9711e8c201fb4a4255dbac98729a456bb5d","src/error.rs":"73ce88d90e3d5a99fc4fdc146fe5405e7d9cdcc5334eb4f0f53e0919c9b19c05","src/lib.rs":"9a415d321a3094ad2b69c40b757fe82b37cc65585f7a41d8a075b6ca5735feea","upgrade.sh":"87498d63d69bb84f04b5b5ca94af03b6c1e6786bee4b28b99b2fb95e489ec74b","upgrade_sqlcipher.sh":"0372ba89bb41427c2c2010a3d41f1363d77eb73bbfecc2fde20aae8499a42a21","wrapper.h":"b78f576f7eeabf316e183d476b0f16344b6897680b4df47628d3ce38c0aa979a","wrapper_ext.h":"fa7a53fea99318ee29d75e6d5fab4d7ed26e9599803268e6a24396265f2a6f3a"},"package":"0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"}

3
third_party/rust/libsqlite3-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2021"
name = "libsqlite3-sys"
version = "0.27.0"
version = "0.28.0"
authors = ["The rusqlite developers"]
build = "build.rs"
links = "sqlite3"
@ -106,5 +106,4 @@ session = [
sqlcipher = []
unlock_notify = []
wasm32-wasi-vfs = []
winsqlite3 = []
with-asan = []

3
third_party/rust/libsqlite3-sys/README.md поставляемый
Просмотреть файл

@ -92,6 +92,7 @@ features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-s
* [`load_extension`](https://docs.rs/rusqlite/~0/rusqlite/struct.LoadExtensionGuard.html)
allows loading dynamic library-based SQLite extensions.
* `loadable_extension` to program [loadable extension](https://sqlite.org/loadext.html) in Rust.
* [`backup`](https://docs.rs/rusqlite/~0/rusqlite/backup/index.html)
allows use of SQLite's online backup API. Note: This feature requires SQLite 3.6.11 or later.
* [`functions`](https://docs.rs/rusqlite/~0/rusqlite/functions/index.html)
@ -136,7 +137,7 @@ features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-s
* `extra_check` fail when a query passed to execute is readonly or has a column count > 0.
* `column_decltype` provides `columns()` method for Statements and Rows; omit if linking to a version of SQLite/SQLCipher compiled with `-DSQLITE_OMIT_DECLTYPE`.
* `collation` exposes [`sqlite3_create_collation_v2`](https://sqlite.org/c3ref/create_collation.html).
* `winsqlite3` allows linking against the SQLite present in newer versions of Windows
* `serialize` exposes [`sqlite3_serialize`](http://sqlite.org/c3ref/serialize.html) (3.23.0).
## Notes on building rusqlite and libsqlite3-sys

58
third_party/rust/libsqlite3-sys/build.rs поставляемый
Просмотреть файл

@ -114,6 +114,7 @@ mod build_bundled {
{
super::copy_bindings(lib_name, "bindgen_bundled_version", out_path);
}
println!("cargo:include={}/{lib_name}", env!("CARGO_MANIFEST_DIR"));
println!("cargo:rerun-if-changed={lib_name}/sqlite3.c");
println!("cargo:rerun-if-changed=sqlite3/wasm32-wasi-vfs.c");
let mut cfg = cc::Build::new();
@ -246,11 +247,16 @@ mod build_bundled {
if !win_target() {
cfg.flag("-DHAVE_LOCALTIME_R");
}
// Target wasm32-wasi can't compile the default VFS
if env::var("TARGET").map_or(false, |v| v == "wasm32-wasi") {
cfg.flag("-DSQLITE_OS_OTHER")
cfg.flag("-USQLITE_THREADSAFE")
.flag("-DSQLITE_THREADSAFE=0")
// https://github.com/rust-lang/rust/issues/74393
.flag("-DLONGDOUBLE_TYPE=double");
.flag("-DLONGDOUBLE_TYPE=double")
.flag("-D_WASI_EMULATED_MMAN")
.flag("-D_WASI_EMULATED_GETPID")
.flag("-D_WASI_EMULATED_SIGNAL")
.flag("-D_WASI_EMULATED_PROCESS_CLOCKS");
if cfg!(feature = "wasm32-wasi-vfs") {
cfg.file("sqlite3/wasm32-wasi-vfs.c");
}
@ -326,8 +332,6 @@ fn env_prefix() -> &'static str {
fn lib_name() -> &'static str {
if cfg!(any(feature = "sqlcipher", feature = "bundled-sqlcipher")) {
"sqlcipher"
} else if cfg!(all(windows, feature = "winsqlite3")) {
"winsqlite3"
} else {
"sqlite3"
}
@ -345,10 +349,7 @@ impl From<HeaderLocation> for String {
HeaderLocation::FromEnvironment => {
let prefix = env_prefix();
let mut header = env::var(format!("{prefix}_INCLUDE_DIR")).unwrap_or_else(|_| {
panic!(
"{}_INCLUDE_DIR must be set if {}_LIB_DIR is set",
prefix, prefix
)
panic!("{prefix}_INCLUDE_DIR must be set if {prefix}_LIB_DIR is set")
});
header.push_str(if cfg!(feature = "loadable_extension") {
"/sqlite3ext.h"
@ -431,12 +432,6 @@ mod build_linked {
#[cfg(not(feature = "loadable_extension"))]
println!("cargo:link-target={link_lib}");
if win_target() && cfg!(feature = "winsqlite3") {
#[cfg(not(feature = "loadable_extension"))]
println!("cargo:rustc-link-lib=dylib={link_lib}");
return HeaderLocation::Wrapper;
}
// Allow users to specify where to find SQLite.
if let Ok(dir) = env::var(format!("{}_LIB_DIR", env_prefix())) {
// Try to use pkg-config to determine link commands
@ -512,9 +507,6 @@ mod bindings {
use bindgen::callbacks::{IntKind, ParseCallbacks};
use std::path::Path;
use super::win_target;
#[derive(Debug)]
struct SqliteTypeChooser;
@ -597,36 +589,6 @@ mod bindings {
if cfg!(feature = "session") {
bindings = bindings.clang_arg("-DSQLITE_ENABLE_SESSION");
}
if win_target() && cfg!(feature = "winsqlite3") {
bindings = bindings
.clang_arg("-DBINDGEN_USE_WINSQLITE3")
.blocklist_item("NTDDI_.+")
.blocklist_item("WINAPI_FAMILY.*")
.blocklist_item("_WIN32_.+")
.blocklist_item("_VCRT_COMPILER_PREPROCESSOR")
.blocklist_item("_SAL_VERSION")
.blocklist_item("__SAL_H_VERSION")
.blocklist_item("_USE_DECLSPECS_FOR_SAL")
.blocklist_item("_USE_ATTRIBUTES_FOR_SAL")
.blocklist_item("_CRT_PACKING")
.blocklist_item("_HAS_EXCEPTIONS")
.blocklist_item("_STL_LANG")
.blocklist_item("_HAS_CXX17")
.blocklist_item("_HAS_CXX20")
.blocklist_item("_HAS_NODISCARD")
.blocklist_item("WDK_NTDDI_VERSION")
.blocklist_item("OSVERSION_MASK")
.blocklist_item("SPVERSION_MASK")
.blocklist_item("SUBVERSION_MASK")
.blocklist_item("WINVER")
.blocklist_item("__security_cookie")
.blocklist_type("size_t")
.blocklist_type("__vcrt_bool")
.blocklist_type("wchar_t")
.blocklist_function("__security_init_cookie")
.blocklist_function("__report_gsfailure")
.blocklist_function("__va_start");
}
// When cross compiling unless effort is taken to fix the issue, bindgen
// will find the wrong headers. There's only one header included by the

Просмотреть файл

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.69.1 */
/* automatically generated by rust-bindgen 0.69.2 */
extern "C" {
pub fn sqlite3_auto_extension(
@ -23,10 +23,10 @@ extern "C" {
) -> ::std::os::raw::c_int;
}
pub const SQLITE_VERSION: &[u8; 7] = b"3.44.0\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3044000;
pub const SQLITE_VERSION: &[u8; 7] = b"3.45.0\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3045000;
pub const SQLITE_SOURCE_ID: &[u8; 85] =
b"2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301\0";
b"2024-01-15 17:01:13 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d\0";
pub const SQLITE_OK: i32 = 0;
pub const SQLITE_ERROR: i32 = 1;
pub const SQLITE_INTERNAL: i32 = 2;
@ -353,6 +353,7 @@ pub const SQLITE_DETERMINISTIC: i32 = 2048;
pub const SQLITE_DIRECTONLY: i32 = 524288;
pub const SQLITE_SUBTYPE: i32 = 1048576;
pub const SQLITE_INNOCUOUS: i32 = 2097152;
pub const SQLITE_RESULT_SUBTYPE: i32 = 16777216;
pub const SQLITE_WIN32_DATA_DIRECTORY_TYPE: i32 = 1;
pub const SQLITE_WIN32_TEMP_DIRECTORY_TYPE: i32 = 2;
pub const SQLITE_TXN_NONE: i32 = 0;
@ -405,6 +406,7 @@ pub const SQLITE_TESTCTRL_PENDING_BYTE: i32 = 11;
pub const SQLITE_TESTCTRL_ASSERT: i32 = 12;
pub const SQLITE_TESTCTRL_ALWAYS: i32 = 13;
pub const SQLITE_TESTCTRL_RESERVE: i32 = 14;
pub const SQLITE_TESTCTRL_JSON_SELFCHECK: i32 = 14;
pub const SQLITE_TESTCTRL_OPTIMIZATIONS: i32 = 15;
pub const SQLITE_TESTCTRL_ISKEYWORD: i32 = 16;
pub const SQLITE_TESTCTRL_SCRATCHMALLOC: i32 = 17;
@ -3590,6 +3592,24 @@ pub struct Fts5ExtensionApi {
piCol: *mut ::std::os::raw::c_int,
),
>,
pub xQueryToken: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut Fts5Context,
iPhrase: ::std::os::raw::c_int,
iToken: ::std::os::raw::c_int,
ppToken: *mut *const ::std::os::raw::c_char,
pnToken: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int,
>,
pub xInstToken: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut Fts5Context,
iIdx: ::std::os::raw::c_int,
iToken: ::std::os::raw::c_int,
arg2: *mut *const ::std::os::raw::c_char,
arg3: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int,
>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]

Просмотреть файл

@ -1,9 +1,9 @@
/* automatically generated by rust-bindgen 0.69.1 */
/* automatically generated by rust-bindgen 0.69.2 */
pub const SQLITE_VERSION: &[u8; 7] = b"3.44.0\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3044000;
pub const SQLITE_VERSION: &[u8; 7] = b"3.45.0\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3045000;
pub const SQLITE_SOURCE_ID: &[u8; 85] =
b"2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301\0";
b"2024-01-15 17:01:13 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d\0";
pub const SQLITE_OK: i32 = 0;
pub const SQLITE_ERROR: i32 = 1;
pub const SQLITE_INTERNAL: i32 = 2;
@ -330,6 +330,7 @@ pub const SQLITE_DETERMINISTIC: i32 = 2048;
pub const SQLITE_DIRECTONLY: i32 = 524288;
pub const SQLITE_SUBTYPE: i32 = 1048576;
pub const SQLITE_INNOCUOUS: i32 = 2097152;
pub const SQLITE_RESULT_SUBTYPE: i32 = 16777216;
pub const SQLITE_WIN32_DATA_DIRECTORY_TYPE: i32 = 1;
pub const SQLITE_WIN32_TEMP_DIRECTORY_TYPE: i32 = 2;
pub const SQLITE_TXN_NONE: i32 = 0;
@ -382,6 +383,7 @@ pub const SQLITE_TESTCTRL_PENDING_BYTE: i32 = 11;
pub const SQLITE_TESTCTRL_ASSERT: i32 = 12;
pub const SQLITE_TESTCTRL_ALWAYS: i32 = 13;
pub const SQLITE_TESTCTRL_RESERVE: i32 = 14;
pub const SQLITE_TESTCTRL_JSON_SELFCHECK: i32 = 14;
pub const SQLITE_TESTCTRL_OPTIMIZATIONS: i32 = 15;
pub const SQLITE_TESTCTRL_ISKEYWORD: i32 = 16;
pub const SQLITE_TESTCTRL_SCRATCHMALLOC: i32 = 17;
@ -1312,6 +1314,24 @@ pub struct Fts5ExtensionApi {
piCol: *mut ::std::os::raw::c_int,
),
>,
pub xQueryToken: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut Fts5Context,
iPhrase: ::std::os::raw::c_int,
iToken: ::std::os::raw::c_int,
ppToken: *mut *const ::std::os::raw::c_char,
pnToken: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int,
>,
pub xInstToken: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut Fts5Context,
iIdx: ::std::os::raw::c_int,
iToken: ::std::os::raw::c_int,
arg2: *mut *const ::std::os::raw::c_char,
arg3: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int,
>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.44.0"
#define SQLITE_VERSION_NUMBER 3044000
#define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301"
#define SQLITE_VERSION "3.45.0"
#define SQLITE_VERSION_NUMBER 3045000
#define SQLITE_SOURCE_ID "2024-01-15 17:01:13 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d"
/*
** CAPI3REF: Run-Time Library Version Numbers
@ -3954,15 +3954,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
** </ul>
**
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
** text that describes the error, as either UTF-8 or UTF-16 respectively.
** text that describes the error, as either UTF-8 or UTF-16 respectively,
** or NULL if no error message is available.
** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
** ^(Memory to hold the error message string is managed internally.
** The application does not need to worry about freeing the result.
** However, the error string might be overwritten or deallocated by
** subsequent calls to other SQLite interface functions.)^
**
** ^The sqlite3_errstr() interface returns the English-language text
** that describes the [result code], as UTF-8.
** ^The sqlite3_errstr(E) interface returns the English-language text
** that describes the [result code] E, as UTF-8, or NULL if E is not an
** result code for which a text error message is available.
** ^(Memory to hold the error message string is managed internally
** and must not be freed by the application)^.
**
@ -5573,13 +5575,27 @@ SQLITE_API int sqlite3_create_window_function(
** </dd>
**
** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
** Specifying this flag makes no difference for scalar or aggregate user
** functions. However, if it is not specified for a user-defined window
** function, then any sub-types belonging to arguments passed to the window
** function may be discarded before the window function is called (i.e.
** sqlite3_value_subtype() will always return 0).
** This flag instructs SQLite to omit some corner-case optimizations that
** might disrupt the operation of the [sqlite3_value_subtype()] function,
** causing it to return zero rather than the correct subtype().
** SQL functions that invokes [sqlite3_value_subtype()] should have this
** property. If the SQLITE_SUBTYPE property is omitted, then the return
** value from [sqlite3_value_subtype()] might sometimes be zero even though
** a non-zero subtype was specified by the function argument expression.
**
** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
** result.
** Every function that invokes [sqlite3_result_subtype()] should have this
** property. If it does not, then the call to [sqlite3_result_subtype()]
** might become a no-op if the function is used as term in an
** [expression index]. On the other hand, SQL functions that never invoke
** [sqlite3_result_subtype()] should avoid setting this property, as the
** purpose of this property is to disable certain optimizations that are
** incompatible with subtypes.
** </dd>
** </dl>
*/
@ -5587,6 +5603,7 @@ SQLITE_API int sqlite3_create_window_function(
#define SQLITE_DIRECTONLY 0x000080000
#define SQLITE_SUBTYPE 0x000100000
#define SQLITE_INNOCUOUS 0x000200000
#define SQLITE_RESULT_SUBTYPE 0x001000000
/*
** CAPI3REF: Deprecated Functions
@ -5783,6 +5800,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
** information can be used to pass a limited amount of context from
** one SQL function to another. Use the [sqlite3_result_subtype()]
** routine to set the subtype for the return value of an SQL function.
**
** Every [application-defined SQL function] that invoke this interface
** should include the [SQLITE_SUBTYPE] property in the text
** encoding argument when the function is [sqlite3_create_function|registered].
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
** might return zero instead of the upstream subtype in some corner cases.
*/
SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
@ -5913,14 +5936,22 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
** parameter)^, or
** <li> ^(during the original sqlite3_set_auxdata() call when a memory
** allocation error occurs.)^ </ul>
** allocation error occurs.)^
** <li> ^(during the original sqlite3_set_auxdata() call if the function
** is evaluated during query planning instead of during query execution,
** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
**
** Note the last bullet in particular. The destructor X in
** Note the last two bullets in particular. The destructor X in
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
** should be called near the end of the function implementation and the
** function implementation should not make any use of P after
** sqlite3_set_auxdata() has been called.
** sqlite3_set_auxdata() has been called. Furthermore, a call to
** sqlite3_get_auxdata() that occurs immediately after a corresponding call
** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
** condition occurred during the sqlite3_set_auxdata() call or if the
** function is being evaluated during query planning rather than during
** query execution.
**
** ^(In practice, auxiliary data is preserved between function calls for
** function parameters that are compile-time constants, including literal
@ -6194,6 +6225,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
** higher order bits are discarded.
** The number of subtype bytes preserved by SQLite might increase
** in future releases of SQLite.
**
** Every [application-defined SQL function] that invokes this interface
** should include the [SQLITE_RESULT_SUBTYPE] property in its
** text encoding argument when the SQL function is
** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
** property is omitted from the function that invokes sqlite3_result_subtype(),
** then in some cases the sqlite3_result_subtype() might fail to set
** the result subtype.
**
** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
** SQL function that invokes the sqlite3_result_subtype() interface
** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
** by default.
*/
SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
@ -7994,9 +8039,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
**
** ^(Some systems (for example, Windows 95) do not support the operation
** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
** will always return SQLITE_BUSY. The SQLite core only ever uses
** sqlite3_mutex_try() as an optimization so this is acceptable
** behavior.)^
** will always return SQLITE_BUSY. In most cases the SQLite core only uses
** sqlite3_mutex_try() as an optimization, so this is acceptable
** behavior. The exceptions are unix builds that set the
** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
** sqlite3_mutex_try() is required.)^
**
** ^The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread. The behavior
@ -8255,6 +8302,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_ASSERT 12
#define SQLITE_TESTCTRL_ALWAYS 13
#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
@ -12768,8 +12816,11 @@ struct Fts5PhraseIter {
** created with the "columnsize=0" option.
**
** xColumnText:
** This function attempts to retrieve the text of column iCol of the
** current document. If successful, (*pz) is set to point to a buffer
** If parameter iCol is less than zero, or greater than or equal to the
** number of columns in the table, SQLITE_RANGE is returned.
**
** Otherwise, this function attempts to retrieve the text of column iCol of
** the current document. If successful, (*pz) is set to point to a buffer
** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
** if an error occurs, an SQLite error code is returned and the final values
@ -12779,8 +12830,10 @@ struct Fts5PhraseIter {
** Returns the number of phrases in the current query expression.
**
** xPhraseSize:
** Returns the number of tokens in phrase iPhrase of the query. Phrases
** are numbered starting from zero.
** If parameter iCol is less than zero, or greater than or equal to the
** number of phrases in the current query, as returned by xPhraseCount,
** 0 is returned. Otherwise, this function returns the number of tokens in
** phrase iPhrase of the query. Phrases are numbered starting from zero.
**
** xInstCount:
** Set *pnInst to the total number of occurrences of all phrases within
@ -12796,12 +12849,13 @@ struct Fts5PhraseIter {
** Query for the details of phrase match iIdx within the current row.
** Phrase matches are numbered starting from zero, so the iIdx argument
** should be greater than or equal to zero and smaller than the value
** output by xInstCount().
** output by xInstCount(). If iIdx is less than zero or greater than
** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
**
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
** to the column in which it occurs and *piOff the token offset of the
** first token of the phrase. Returns SQLITE_OK if successful, or an error
** code (i.e. SQLITE_NOMEM) if an error occurs.
** first token of the phrase. SQLITE_OK is returned if successful, or an
** error code (i.e. SQLITE_NOMEM) if an error occurs.
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
@ -12827,6 +12881,10 @@ struct Fts5PhraseIter {
** Invoking Api.xUserData() returns a copy of the pointer passed as
** the third argument to pUserData.
**
** If parameter iPhrase is less than zero, or greater than or equal to
** the number of phrases in the query, as returned by xPhraseCount(),
** this function returns SQLITE_RANGE.
**
** If the callback function returns any value other than SQLITE_OK, the
** query is abandoned and the xQueryPhrase function returns immediately.
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
@ -12941,9 +12999,42 @@ struct Fts5PhraseIter {
**
** xPhraseNextColumn()
** See xPhraseFirstColumn above.
**
** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
** This is used to access token iToken of phrase iPhrase of the current
** query. Before returning, output parameter *ppToken is set to point
** to a buffer containing the requested token, and *pnToken to the
** size of this buffer in bytes.
**
** If iPhrase or iToken are less than zero, or if iPhrase is greater than
** or equal to the number of phrases in the query as reported by
** xPhraseCount(), or if iToken is equal to or greater than the number of
** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
are both zeroed.
**
** The output text is not a copy of the query text that specified the
** token. It is the output of the tokenizer module. For tokendata=1
** tables, this includes any embedded 0x00 and trailing data.
**
** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
** This is used to access token iToken of phrase hit iIdx within the
** current row. If iIdx is less than zero or greater than or equal to the
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
** output variable (*ppToken) is set to point to a buffer containing the
** matching document token, and (*pnToken) to the size of that buffer in
** bytes. This API is not available if the specified token matches a
** prefix query term. In that case both output variables are always set
** to 0.
**
** The output text is not a copy of the document text that was tokenized.
** It is the output of the tokenizer module. For tokendata=1 tables, this
** includes any embedded 0x00 and trailing data.
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
*/
struct Fts5ExtensionApi {
int iVersion; /* Currently always set to 2 */
int iVersion; /* Currently always set to 3 */
void *(*xUserData)(Fts5Context*);
@ -12978,6 +13069,13 @@ struct Fts5ExtensionApi {
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
/* Below this point are iVersion>=3 only */
int (*xQueryToken)(Fts5Context*,
int iPhrase, int iToken,
const char **ppToken, int *pnToken
);
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
};
/*

3
third_party/rust/libsqlite3-sys/src/lib.rs поставляемый
Просмотреть файл

@ -5,9 +5,6 @@
#[cfg(feature = "bundled-sqlcipher-vendored-openssl")]
extern crate openssl_sys;
#[cfg(all(windows, feature = "winsqlite3", target_pointer_width = "32"))]
compile_error!("The `libsqlite3-sys/winsqlite3` feature is not supported on 32 bit targets.");
pub use self::error::*;
use std::default::Default;

4
third_party/rust/libsqlite3-sys/upgrade.sh поставляемый
Просмотреть файл

@ -9,8 +9,8 @@ export SQLITE3_LIB_DIR="$SCRIPT_DIR/sqlite3"
mkdir -p "$TARGET_DIR" "$SQLITE3_LIB_DIR"
# Download and extract amalgamation
SQLITE=sqlite-amalgamation-3440000
curl -O https://sqlite.org/2023/$SQLITE.zip
SQLITE=sqlite-amalgamation-3450000
curl -O https://sqlite.org/2024/$SQLITE.zip
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c"
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h"
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3ext.h" > "$SQLITE3_LIB_DIR/sqlite3ext.h"

4
third_party/rust/libsqlite3-sys/wrapper.h поставляемый
Просмотреть файл

@ -1,5 +1 @@
#ifdef BINDGEN_USE_WINSQLITE3
#include <winsqlite/winsqlite3.h>
#else
#include "sqlite3.h"
#endif

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"2abeb56ca3df256327b4ce5c9ddf4097b7487784287b6cd012139198190cafc0","build.rs":"a562bfe527d21c4e8a1a44b892defa83cdff141ec5dd51ed6f3862330e50ddd7","src/bin/generate-test-data.rs":"7f1c9dc445418c7627f89d1f2aa8e550d0f85b3d1f05edb7c378ab9441714f1f","src/db.rs":"7ca5688c42d44ad6e5320208257d131c5c744be47a1cfe3e1380147abf2aadc3","src/error.rs":"bda332098f9759e4250c725b09d82704ba03c9ad87dc761414fa21f40220acf5","src/ingest.rs":"58bb3ed984aa5a9becb405793832e578586be744d3c4a1c411fdfb7ff48c55dd","src/interest.rs":"68b77eb1eb8511b846b36b5dddc02e8578e26421c5ba28ac7abab86c03ca2255","src/lib.rs":"5ed2d6829b1b537425936bcbfd32b74312dc5fd8a17a09a3a7c1ab45e85f396c","src/relevancy.udl":"9f463bbc2a7ef28358ffbfe832e62ddd6127888c484576466c759b127a55c4b2","src/rs.rs":"5803bf8deac969b2e1fc3ea0faeb592604b5e90524a2f4469565702b30c49da6","src/schema.rs":"f782c712f10c4f1af2f9e1424d6b52f59a2bacfcc452a8feb763f36478f5dd5d","src/url_hash.rs":"2e908316fb70923644d1990dbf470d69ce2f5e99b0c5c3d95ec691590be8ffa5","test-data":"1ef2cd092d59e7e126cd4a514af983d449ed9f9c98708702fd237464a76c2b5e"},"package":null}
{"files":{"Cargo.toml":"970c64cc4ed32fddac6b8cc2a83e7eb4e57aa249b8034d2d67cb56efa8475522","build.rs":"a562bfe527d21c4e8a1a44b892defa83cdff141ec5dd51ed6f3862330e50ddd7","src/bin/generate-test-data.rs":"7f1c9dc445418c7627f89d1f2aa8e550d0f85b3d1f05edb7c378ab9441714f1f","src/db.rs":"7ca5688c42d44ad6e5320208257d131c5c744be47a1cfe3e1380147abf2aadc3","src/error.rs":"bda332098f9759e4250c725b09d82704ba03c9ad87dc761414fa21f40220acf5","src/ingest.rs":"58bb3ed984aa5a9becb405793832e578586be744d3c4a1c411fdfb7ff48c55dd","src/interest.rs":"68b77eb1eb8511b846b36b5dddc02e8578e26421c5ba28ac7abab86c03ca2255","src/lib.rs":"5ed2d6829b1b537425936bcbfd32b74312dc5fd8a17a09a3a7c1ab45e85f396c","src/relevancy.udl":"9f463bbc2a7ef28358ffbfe832e62ddd6127888c484576466c759b127a55c4b2","src/rs.rs":"5803bf8deac969b2e1fc3ea0faeb592604b5e90524a2f4469565702b30c49da6","src/schema.rs":"f782c712f10c4f1af2f9e1424d6b52f59a2bacfcc452a8feb763f36478f5dd5d","src/url_hash.rs":"2e908316fb70923644d1990dbf470d69ce2f5e99b0c5c3d95ec691590be8ffa5","test-data":"1ef2cd092d59e7e126cd4a514af983d449ed9f9c98708702fd237464a76c2b5e"},"package":null}

2
third_party/rust/relevancy/Cargo.toml поставляемый
Просмотреть файл

@ -46,7 +46,7 @@ path = "../support/interrupt"
path = "../remote_settings"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = ["bundled"]
[dependencies.serde]

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

418
third_party/rust/rusqlite/Cargo.lock сгенерированный поставляемый
Просмотреть файл

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "ahash"
version = "0.8.6"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff"
dependencies = [
"cfg-if",
"once_cell",
@ -58,16 +58,16 @@ checksum = "7dfdb4953a096c551ce9ace855a604d702e6e62d77fac690575ae347571717f5"
[[package]]
name = "bindgen"
version = "0.69.1"
version = "0.69.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2"
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
dependencies = [
"bitflags 2.4.1",
"bitflags",
"cexpr",
"clang-sys",
"itertools",
"lazy_static",
"lazycell",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
@ -78,21 +78,15 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.3.2"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "bumpalo"
version = "3.14.0"
version = "3.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f"
[[package]]
name = "cc"
@ -120,21 +114,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.31"
version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
dependencies = [
"android-tzdata",
"iana-time-zone",
"num-traits",
"windows-targets",
"windows-targets 0.52.0",
]
[[package]]
name = "clang-sys"
version = "1.6.1"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1"
dependencies = [
"glob",
"libc",
@ -143,9 +137,9 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "csv"
@ -170,9 +164,9 @@ dependencies = [
[[package]]
name = "deranged"
version = "0.3.9"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
@ -183,6 +177,12 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "equivalent"
version = "1.0.1"
@ -191,12 +191,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.6"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
@ -219,18 +219,18 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
[[package]]
name = "getrandom"
version = "0.2.11"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [
"cfg-if",
"libc",
@ -245,9 +245,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "hashbrown"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash",
"allocator-api2",
@ -255,18 +255,18 @@ dependencies = [
[[package]]
name = "hashlink"
version = "0.8.4"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
checksum = "692eaaf7f7607518dd3cef090f1474b61edc5301d8012f09579920df68b725ee"
dependencies = [
"hashbrown",
]
[[package]]
name = "iana-time-zone"
version = "0.1.58"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@ -287,9 +287,9 @@ dependencies = [
[[package]]
name = "idna"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@ -297,25 +297,34 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "itoa"
version = "1.0.9"
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
version = "0.3.65"
version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8"
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
dependencies = [
"wasm-bindgen",
]
@ -334,25 +343,25 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.150"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libloading"
version = "0.7.4"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161"
dependencies = [
"cfg-if",
"winapi",
"windows-sys 0.48.0",
]
[[package]]
name = "libsqlite3-sys"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"
dependencies = [
"bindgen",
"cc",
@ -366,9 +375,15 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
version = "0.4.11"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "litrs"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
[[package]]
name = "log"
@ -378,9 +393,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.6.4"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "minimal-lexical"
@ -399,34 +414,40 @@ dependencies = [
]
[[package]]
name = "num-traits"
version = "0.2.17"
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.18.0"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openssl-src"
version = "300.1.6+3.1.4"
version = "300.2.3+3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085"
checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843"
dependencies = [
"cc",
]
[[package]]
name = "openssl-sys"
version = "0.9.95"
version = "0.9.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9"
checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae"
dependencies = [
"cc",
"libc",
@ -435,17 +456,11 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "phf"
@ -488,9 +503,9 @@ dependencies = [
[[package]]
name = "pkg-config"
version = "0.3.27"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "powerfmt"
@ -500,9 +515,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "prettyplease"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d"
checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5"
dependencies = [
"proc-macro2",
"syn",
@ -510,18 +525,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.69"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@ -541,20 +556,11 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "regex"
version = "1.10.2"
version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
@ -564,9 +570,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.3"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [
"aho-corasick",
"memchr",
@ -581,10 +587,10 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rusqlite"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"bencher",
"bitflags 2.4.1",
"bitflags",
"chrono",
"csv",
"doc-comment",
@ -606,11 +612,12 @@ dependencies = [
[[package]]
name = "rusqlite-macros"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d92a8272e44aab115714abdf828c98edca44c8fc69861b44465cc77cfb56f2d"
checksum = "b731f4dfccf49c70c3ccfd51bc40469f73566d30b0bb06cf242a6e820f42c51f"
dependencies = [
"fallible-iterator",
"litrs",
"sqlite3-parser",
]
@ -622,37 +629,37 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.38.21"
version = "0.38.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [
"bitflags 2.4.1",
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "ryu"
version = "1.0.15"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
[[package]]
name = "serde"
version = "1.0.192"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.192"
version = "1.0.196"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [
"proc-macro2",
"quote",
@ -661,9 +668,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.108"
version = "1.0.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79"
dependencies = [
"itoa",
"ryu",
@ -672,9 +679,9 @@ dependencies = [
[[package]]
name = "shlex"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "siphasher"
@ -684,9 +691,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "smallvec"
version = "1.11.2"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "sqlite3-parser"
@ -694,7 +701,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9add252f9b70a7d493b03127524ed06cdf7480b3dc8c1b2ccfda89384d90a8b7"
dependencies = [
"bitflags 2.4.1",
"bitflags",
"cc",
"fallible-iterator",
"indexmap",
@ -709,9 +716,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.39"
version = "2.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496"
dependencies = [
"proc-macro2",
"quote",
@ -720,25 +727,25 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.8.1"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall",
"rustix",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "time"
version = "0.3.30"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
@ -753,10 +760,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.15"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20"
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
dependencies = [
"num-conv",
"time-core",
]
@ -777,9 +785,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "uncased"
version = "0.9.9"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68"
checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697"
dependencies = [
"version_check",
]
@ -795,9 +803,9 @@ dependencies = [
[[package]]
name = "unicode-bidi"
version = "0.3.13"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-ident"
@ -816,9 +824,9 @@ dependencies = [
[[package]]
name = "url"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
@ -827,9 +835,9 @@ dependencies = [
[[package]]
name = "uuid"
version = "1.5.0"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
dependencies = [
"getrandom",
]
@ -854,9 +862,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce"
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -864,9 +872,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217"
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
dependencies = [
"bumpalo",
"log",
@ -879,9 +887,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2"
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -889,9 +897,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [
"proc-macro2",
"quote",
@ -902,39 +910,17 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.88"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
[[package]]
name = "windows-core"
version = "0.51.1"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
"windows-targets 0.52.0",
]
[[package]]
@ -943,7 +929,16 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
@ -952,13 +947,28 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
]
[[package]]
@ -967,36 +977,72 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
@ -1004,19 +1050,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "zerocopy"
version = "0.7.25"
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "zerocopy"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.25"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",

12
third_party/rust/rusqlite/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2021"
name = "rusqlite"
version = "0.30.0"
version = "0.31.0"
authors = ["The rusqlite developers"]
exclude = [
"/.github/*",
@ -59,9 +59,7 @@ name = "loadable_extension"
crate-type = ["cdylib"]
required-features = [
"loadable_extension",
"modern_sqlite",
"functions",
"vtab",
"trace",
]
@ -71,7 +69,6 @@ required-features = [
"load_extension",
"bundled",
"functions",
"vtab",
"trace",
]
@ -113,13 +110,13 @@ version = "0.3"
version = "0.1"
[dependencies.hashlink]
version = "0.8"
version = "0.9"
[dependencies.libsqlite3-sys]
version = "0.27.0"
version = "0.28.0"
[dependencies.rusqlite-macros]
version = "0.1.0"
version = "0.2.0"
optional = true
[dependencies.serde_json]
@ -246,7 +243,6 @@ unlock_notify = ["libsqlite3-sys/unlock_notify"]
vtab = []
wasm32-wasi-vfs = ["libsqlite3-sys/wasm32-wasi-vfs"]
window = ["functions"]
winsqlite3 = ["libsqlite3-sys/winsqlite3"]
with-asan = ["libsqlite3-sys/with-asan"]
[badges.appveyor]

11
third_party/rust/rusqlite/README.md поставляемый
Просмотреть файл

@ -27,7 +27,7 @@ In your Cargo.toml:
# That said, it's not ideal for all scenarios and in particular, generic
# libraries built around `rusqlite` should probably not enable it, which
# is why it is not a default feature -- it could become hard to disable.
rusqlite = { version = "0.30.0", features = ["bundled"] }
rusqlite = { version = "0.31.0", features = ["bundled"] }
```
Simple example usage:
@ -92,6 +92,7 @@ features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-s
* [`load_extension`](https://docs.rs/rusqlite/~0/rusqlite/struct.LoadExtensionGuard.html)
allows loading dynamic library-based SQLite extensions.
* `loadable_extension` to program [loadable extension](https://sqlite.org/loadext.html) in Rust.
* [`backup`](https://docs.rs/rusqlite/~0/rusqlite/backup/index.html)
allows use of SQLite's online backup API. Note: This feature requires SQLite 3.6.11 or later.
* [`functions`](https://docs.rs/rusqlite/~0/rusqlite/functions/index.html)
@ -136,7 +137,7 @@ features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-s
* `extra_check` fail when a query passed to execute is readonly or has a column count > 0.
* `column_decltype` provides `columns()` method for Statements and Rows; omit if linking to a version of SQLite/SQLCipher compiled with `-DSQLITE_OMIT_DECLTYPE`.
* `collation` exposes [`sqlite3_create_collation_v2`](https://sqlite.org/c3ref/create_collation.html).
* `winsqlite3` allows linking against the SQLite present in newer versions of Windows
* `serialize` exposes [`sqlite3_serialize`](http://sqlite.org/c3ref/serialize.html) (3.23.0).
## Notes on building rusqlite and libsqlite3-sys
@ -149,11 +150,11 @@ You can adjust this behavior in a number of ways:
* If you use the `bundled`, `bundled-sqlcipher`, or `bundled-sqlcipher-vendored-openssl` features, `libsqlite3-sys` will use the
[cc](https://crates.io/crates/cc) crate to compile SQLite or SQLCipher from source and
link against that. This source is embedded in the `libsqlite3-sys` crate and
is currently SQLite 3.44.0 (as of `rusqlite` 0.30.0 / `libsqlite3-sys`
0.27.0). This is probably the simplest solution to any build problems. You can enable this by adding the following in your `Cargo.toml` file:
is currently SQLite 3.45.1 (as of `rusqlite` 0.31.0 / `libsqlite3-sys`
0.28.0). This is probably the simplest solution to any build problems. You can enable this by adding the following in your `Cargo.toml` file:
```toml
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = ["bundled"]
```
* When using any of the `bundled` features, the build script will honor `SQLITE_MAX_VARIABLE_NUMBER` and `SQLITE_MAX_EXPR_DEPTH` variables. It will also honor a `LIBSQLITE3_FLAGS` variable, which can have a format like `"-USQLITE_ALPHA -DSQLITE_BETA SQLITE_GAMMA ..."`. That would disable the `SQLITE_ALPHA` flag, and set the `SQLITE_BETA` and `SQLITE_GAMMA` flags. (The initial `-D` can be omitted, as on the last one.)

Просмотреть файл

@ -1,16 +1,20 @@
//! Ensure loadable_extension.rs works.
use rusqlite::{Connection, Result};
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
fn main() -> Result<()> {
let db = Connection::open_in_memory()?;
unsafe {
db.load_extension_enable()?;
#[cfg(not(windows))]
db.load_extension("target/debug/examples/libloadable_extension", None)?;
#[cfg(windows)]
db.load_extension("target/debug/examples/loadable_extension", None)?;
db.load_extension(
format!(
"target/debug/examples/{}loadable_extension{}",
DLL_PREFIX, DLL_SUFFIX
),
None,
)?;
db.load_extension_disable()?;
}

Просмотреть файл

@ -8,7 +8,7 @@ use rusqlite::{to_sqlite_error, Connection, Result};
/// # build
/// ```sh
/// cargo build --example loadable_extension --features "loadable_extension modern_sqlite functions vtab trace"
/// cargo build --example loadable_extension --features "loadable_extension functions trace"
/// ```
/// # test
/// ```sh

28
third_party/rust/rusqlite/examples/persons/README.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,28 @@
# Persons example
## Run
```
$ cargo run --example persons
```
## Run (wasm32-wasi)
### Requisites
- [wasi-sdk](https://github.com/WebAssembly/wasi-sdk)
- [wasmtime](https://wasmtime.dev/)
```
# Set to wasi-sdk directory
$ export WASI_SDK_PATH=`<wasi-sdk-path>`
$ export CC_wasm32_wasi="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
# Build
$ cargo build --example persons --target wasm32-wasi --release --features bundled
# Run
$ wasmtime target/wasm32-wasi/release/examples/persons.wasm
Found persons:
ID: 1, Name: Steven
ID: 2, Name: John
ID: 3, Name: Alex
```

42
third_party/rust/rusqlite/examples/persons/main.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,42 @@
extern crate rusqlite;
use rusqlite::{Connection, Result};
struct Person {
id: i32,
name: String,
}
fn main() -> Result<()> {
let conn = Connection::open_in_memory()?;
conn.execute(
"CREATE TABLE IF NOT EXISTS persons (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
)",
(), // empty list of parameters.
)?;
conn.execute(
"INSERT INTO persons (name) VALUES (?1), (?2), (?3)",
["Steven", "John", "Alex"].map(|n| n.to_string()),
)?;
let mut stmt = conn.prepare("SELECT id, name FROM persons")?;
let rows = stmt.query_map([], |row| {
Ok(Person {
id: row.get(0)?,
name: row.get(1)?,
})
})?;
println!("Found persons:");
for person in rows {
match person {
Ok(p) => println!("ID: {}, Name: {}", p.id, p.name),
Err(e) => eprintln!("Error: {e:?}"),
}
}
Ok(())
}

2
third_party/rust/rusqlite/src/cache.rs поставляемый
Просмотреть файл

@ -57,7 +57,7 @@ impl Connection {
}
/// Prepared statements LRU cache.
// #[derive(Debug)] // FIXME: https://github.com/kyren/hashlink/pull/4
#[derive(Debug)]
pub struct StatementCache(RefCell<LruCache<Arc<str>, RawStatement>>);
#[allow(clippy::non_send_fields_in_send_ty)]

1
third_party/rust/rusqlite/src/config.rs поставляемый
Просмотреть файл

@ -9,6 +9,7 @@ use crate::{Connection, Result};
/// Database Connection Configuration Options
/// See [Database Connection Configuration Options](https://sqlite.org/c3ref/c_dbconfig_enable_fkey.html) for details.
#[repr(i32)]
#[derive(Copy, Clone, Debug)]
#[allow(non_snake_case, non_camel_case_types)]
#[non_exhaustive]
#[allow(clippy::upper_case_acronyms)]

11
third_party/rust/rusqlite/src/context.rs поставляемый
Просмотреть файл

@ -1,5 +1,6 @@
//! Code related to `sqlite3_context` common to `functions` and `vtab` modules.
use libsqlite3_sys::sqlite3_value;
use std::os::raw::{c_int, c_void};
#[cfg(feature = "array")]
use std::rc::Rc;
@ -16,7 +17,11 @@ use crate::vtab::array::{free_array, ARRAY_TYPE};
// is often known to the compiler, and thus const prop/DCE can substantially
// simplify the function.
#[inline]
pub(super) unsafe fn set_result(ctx: *mut sqlite3_context, result: &ToSqlOutput<'_>) {
pub(super) unsafe fn set_result(
ctx: *mut sqlite3_context,
args: &[*mut sqlite3_value],
result: &ToSqlOutput<'_>,
) {
let value = match *result {
ToSqlOutput::Borrowed(v) => v,
ToSqlOutput::Owned(ref v) => ValueRef::from(v),
@ -26,6 +31,10 @@ pub(super) unsafe fn set_result(ctx: *mut sqlite3_context, result: &ToSqlOutput<
// TODO sqlite3_result_zeroblob64 // 3.8.11
return ffi::sqlite3_result_zeroblob(ctx, len);
}
#[cfg(feature = "functions")]
ToSqlOutput::Arg(i) => {
return ffi::sqlite3_result_value(ctx, args[i]);
}
#[cfg(feature = "array")]
ToSqlOutput::Array(ref a) => {
return ffi::sqlite3_result_pointer(

159
third_party/rust/rusqlite/src/functions.rs поставляемый
Просмотреть файл

@ -66,7 +66,7 @@ use crate::ffi::sqlite3_context;
use crate::ffi::sqlite3_value;
use crate::context::set_result;
use crate::types::{FromSql, FromSqlError, ToSql, ValueRef};
use crate::types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef};
use crate::{str_to_cstring, Connection, Error, InnerConnection, Result};
@ -149,6 +149,15 @@ impl Context<'_> {
unsafe { ValueRef::from_value(arg) }
}
/// Returns the `idx`th argument as a `SqlFnArg`.
/// To be used when the SQL function result is one of its arguments.
#[inline]
#[must_use]
pub fn get_arg(&self, idx: usize) -> SqlFnArg {
assert!(idx < self.len());
SqlFnArg { idx }
}
/// Returns the subtype of `idx`th argument.
///
/// # Failure
@ -232,11 +241,6 @@ impl Context<'_> {
phantom: PhantomData,
})
}
/// Set the Subtype of an SQL function
pub fn set_result_subtype(&self, sub_type: std::os::raw::c_uint) {
unsafe { ffi::sqlite3_result_subtype(self.ctx, sub_type) };
}
}
/// A reference to a connection handle with a lifetime bound to something.
@ -258,6 +262,57 @@ impl Deref for ConnectionRef<'_> {
type AuxInner = Arc<dyn Any + Send + Sync + 'static>;
/// Subtype of an SQL function
pub type SubType = Option<std::os::raw::c_uint>;
/// Result of an SQL function
pub trait SqlFnOutput {
/// Converts Rust value to SQLite value with an optional sub-type
fn to_sql(&self) -> Result<(ToSqlOutput<'_>, SubType)>;
}
impl<T: ToSql> SqlFnOutput for T {
#[inline]
fn to_sql(&self) -> Result<(ToSqlOutput<'_>, SubType)> {
ToSql::to_sql(self).map(|o| (o, None))
}
}
impl<T: ToSql> SqlFnOutput for (T, SubType) {
fn to_sql(&self) -> Result<(ToSqlOutput<'_>, SubType)> {
ToSql::to_sql(&self.0).map(|o| (o, self.1))
}
}
/// n-th arg of an SQL scalar function
pub struct SqlFnArg {
idx: usize,
}
impl ToSql for SqlFnArg {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
Ok(ToSqlOutput::Arg(self.idx))
}
}
unsafe fn sql_result<T: SqlFnOutput>(
ctx: *mut sqlite3_context,
args: &[*mut sqlite3_value],
r: Result<T>,
) {
let t = r.as_ref().map(SqlFnOutput::to_sql);
match t {
Ok(Ok((ref value, sub_type))) => {
set_result(ctx, args, value);
if let Some(sub_type) = sub_type {
ffi::sqlite3_result_subtype(ctx, sub_type);
}
}
Ok(Err(err)) => report_error(ctx, &err),
Err(err) => report_error(ctx, err),
};
}
/// Aggregate is the callback interface for user-defined
/// aggregate function.
///
@ -266,7 +321,7 @@ type AuxInner = Arc<dyn Any + Send + Sync + 'static>;
pub trait Aggregate<A, T>
where
A: RefUnwindSafe + UnwindSafe,
T: ToSql,
T: SqlFnOutput,
{
/// Initializes the aggregation context. Will be called prior to the first
/// call to [`step()`](Aggregate::step) to set up the context for an
@ -297,7 +352,7 @@ where
pub trait WindowAggregate<A, T>: Aggregate<A, T>
where
A: RefUnwindSafe + UnwindSafe,
T: ToSql,
T: SqlFnOutput,
{
/// Returns the current value of the aggregate. Unlike xFinal, the
/// implementation should not delete any context.
@ -311,6 +366,7 @@ bitflags::bitflags! {
/// Function Flags.
/// See [sqlite3_create_function](https://sqlite.org/c3ref/create_function.html)
/// and [Function Flags](https://sqlite.org/c3ref/c_deterministic.html) for details.
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct FunctionFlags: ::std::os::raw::c_int {
/// Specifies UTF-8 as the text encoding this SQL function prefers for its parameters.
@ -329,6 +385,8 @@ bitflags::bitflags! {
const SQLITE_SUBTYPE = 0x0000_0010_0000; // 3.30.0
/// Means that the function is unlikely to cause problems even if misused.
const SQLITE_INNOCUOUS = 0x0000_0020_0000; // 3.31.0
/// Indicates to SQLite that a function might call `sqlite3_result_subtype()` to cause a sub-type to be associated with its result.
const SQLITE_RESULT_SUBTYPE = 0x0000_0100_0000; // 3.45.0
}
}
@ -387,7 +445,7 @@ impl Connection {
) -> Result<()>
where
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'static,
T: ToSql,
T: SqlFnOutput,
{
self.db
.borrow_mut()
@ -411,7 +469,7 @@ impl Connection {
where
A: RefUnwindSafe + UnwindSafe,
D: Aggregate<A, T> + 'static,
T: ToSql,
T: SqlFnOutput,
{
self.db
.borrow_mut()
@ -436,7 +494,7 @@ impl Connection {
where
A: RefUnwindSafe + UnwindSafe,
W: WindowAggregate<A, T> + 'static,
T: ToSql,
T: SqlFnOutput,
{
self.db
.borrow_mut()
@ -469,7 +527,7 @@ impl InnerConnection {
) -> Result<()>
where
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'static,
T: ToSql,
T: SqlFnOutput,
{
unsafe extern "C" fn call_boxed_closure<F, T>(
ctx: *mut sqlite3_context,
@ -477,15 +535,13 @@ impl InnerConnection {
argv: *mut *mut sqlite3_value,
) where
F: FnMut(&Context<'_>) -> Result<T>,
T: ToSql,
T: SqlFnOutput,
{
let args = slice::from_raw_parts(argv, argc as usize);
let r = catch_unwind(|| {
let boxed_f: *mut F = ffi::sqlite3_user_data(ctx).cast::<F>();
assert!(!boxed_f.is_null(), "Internal error - null function pointer");
let ctx = Context {
ctx,
args: slice::from_raw_parts(argv, argc as usize),
};
let ctx = Context { ctx, args };
(*boxed_f)(&ctx)
});
let t = match r {
@ -495,13 +551,7 @@ impl InnerConnection {
}
Ok(r) => r,
};
let t = t.as_ref().map(|t| ToSql::to_sql(t));
match t {
Ok(Ok(ref value)) => set_result(ctx, value),
Ok(Err(err)) => report_error(ctx, &err),
Err(err) => report_error(ctx, err),
}
sql_result(ctx, args, t);
}
let boxed_f: *mut F = Box::into_raw(Box::new(x_func));
@ -532,7 +582,7 @@ impl InnerConnection {
where
A: RefUnwindSafe + UnwindSafe,
D: Aggregate<A, T> + 'static,
T: ToSql,
T: SqlFnOutput,
{
let boxed_aggr: *mut D = Box::into_raw(Box::new(aggr));
let c_name = str_to_cstring(fn_name)?;
@ -563,7 +613,7 @@ impl InnerConnection {
where
A: RefUnwindSafe + UnwindSafe,
W: WindowAggregate<A, T> + 'static,
T: ToSql,
T: SqlFnOutput,
{
let boxed_aggr: *mut W = Box::into_raw(Box::new(aggr));
let c_name = str_to_cstring(fn_name)?;
@ -618,7 +668,7 @@ unsafe extern "C" fn call_boxed_step<A, D, T>(
) where
A: RefUnwindSafe + UnwindSafe,
D: Aggregate<A, T>,
T: ToSql,
T: SqlFnOutput,
{
let pac = if let Some(pac) = aggregate_context(ctx, std::mem::size_of::<*mut A>()) {
pac
@ -666,7 +716,7 @@ unsafe extern "C" fn call_boxed_inverse<A, W, T>(
) where
A: RefUnwindSafe + UnwindSafe,
W: WindowAggregate<A, T>,
T: ToSql,
T: SqlFnOutput,
{
let pac = if let Some(pac) = aggregate_context(ctx, std::mem::size_of::<*mut A>()) {
pac
@ -704,7 +754,7 @@ unsafe extern "C" fn call_boxed_final<A, D, T>(ctx: *mut sqlite3_context)
where
A: RefUnwindSafe + UnwindSafe,
D: Aggregate<A, T>,
T: ToSql,
T: SqlFnOutput,
{
// Within the xFinal callback, it is customary to set N=0 in calls to
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
@ -738,12 +788,7 @@ where
}
Ok(r) => r,
};
let t = t.as_ref().map(|t| ToSql::to_sql(t));
match t {
Ok(Ok(ref value)) => set_result(ctx, value),
Ok(Err(err)) => report_error(ctx, &err),
Err(err) => report_error(ctx, err),
}
sql_result(ctx, &[], t);
}
#[cfg(feature = "window")]
@ -751,7 +796,7 @@ unsafe extern "C" fn call_boxed_value<A, W, T>(ctx: *mut sqlite3_context)
where
A: RefUnwindSafe + UnwindSafe,
W: WindowAggregate<A, T>,
T: ToSql,
T: SqlFnOutput,
{
// Within the xValue callback, it is customary to set N=0 in calls to
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
@ -775,12 +820,7 @@ where
}
Ok(r) => r,
};
let t = t.as_ref().map(|t| ToSql::to_sql(t));
match t {
Ok(Ok(ref value)) => set_result(ctx, value),
Ok(Err(err)) => report_error(ctx, &err),
Err(err) => report_error(ctx, err),
}
sql_result(ctx, &[], t);
}
#[cfg(test)]
@ -790,7 +830,7 @@ mod test {
#[cfg(feature = "window")]
use crate::functions::WindowAggregate;
use crate::functions::{Aggregate, Context, FunctionFlags};
use crate::functions::{Aggregate, Context, FunctionFlags, SqlFnArg, SubType};
use crate::{Connection, Error, Result};
fn half(ctx: &Context<'_>) -> Result<c_double> {
@ -1068,4 +1108,37 @@ mod test {
assert_eq!(expected, results);
Ok(())
}
#[test]
fn test_sub_type() -> Result<()> {
fn test_getsubtype(ctx: &Context<'_>) -> Result<i32> {
Ok(ctx.get_subtype(0) as i32)
}
fn test_setsubtype(ctx: &Context<'_>) -> Result<(SqlFnArg, SubType)> {
use std::os::raw::c_uint;
let value = ctx.get_arg(0);
let sub_type = ctx.get::<c_uint>(1)?;
Ok((value, Some(sub_type)))
}
let db = Connection::open_in_memory()?;
db.create_scalar_function(
"test_getsubtype",
1,
FunctionFlags::SQLITE_UTF8,
test_getsubtype,
)?;
db.create_scalar_function(
"test_setsubtype",
2,
FunctionFlags::SQLITE_UTF8 | FunctionFlags::SQLITE_RESULT_SUBTYPE,
test_setsubtype,
)?;
let result: i32 = db.one_column("SELECT test_getsubtype('hello');")?;
assert_eq!(0, result);
let result: i32 = db.one_column("SELECT test_getsubtype(test_setsubtype('hello',123));")?;
assert_eq!(123, result);
Ok(())
}
}

11
third_party/rust/rusqlite/src/lib.rs поставляемый
Просмотреть файл

@ -1494,7 +1494,7 @@ mod test {
#[test]
#[cfg(feature = "extra_check")]
fn test_execute_select() {
fn test_execute_select_with_no_row() {
let db = checked_memory_handle();
let err = db.execute("SELECT 1 WHERE 1 < ?1", [1i32]).unwrap_err();
assert_eq!(
@ -1504,6 +1504,13 @@ mod test {
);
}
#[test]
fn test_execute_select_with_row() {
let db = checked_memory_handle();
let err = db.execute("SELECT 1", []).unwrap_err();
assert_eq!(err, Error::ExecuteReturnedResults);
}
#[test]
#[cfg(feature = "extra_check")]
fn test_execute_multiple() {
@ -1874,7 +1881,7 @@ mod test {
#[test]
fn test_from_handle_owned() -> Result<()> {
let mut handle: *mut ffi::sqlite3 = std::ptr::null_mut();
let r = unsafe { ffi::sqlite3_open(":memory:\0".as_ptr() as *const i8, &mut handle) };
let r = unsafe { ffi::sqlite3_open(":memory:\0".as_ptr() as *const c_char, &mut handle) };
assert_eq!(r, ffi::SQLITE_OK);
let db = unsafe { Connection::from_handle_owned(handle) }?;
db.execute_batch("PRAGMA VACUUM")?;

1
third_party/rust/rusqlite/src/limits.rs поставляемый
Просмотреть файл

@ -9,6 +9,7 @@ use std::os::raw::c_int;
/// See the official documentation for more information:
/// - <https://www.sqlite.org/c3ref/c_limit_attached.html>
/// - <https://www.sqlite.org/limits.html>
#[derive(Copy, Clone, Debug)]
#[repr(i32)]
#[non_exhaustive]
#[allow(clippy::upper_case_acronyms, non_camel_case_types)]

4
third_party/rust/rusqlite/src/params.rs поставляемый
Просмотреть файл

@ -41,7 +41,7 @@ use sealed::Sealed;
/// - Using the [`rusqlite::params!`](crate::params!) macro, e.g.
/// `thing.query(rusqlite::params![1, "foo", bar])`. This is mostly useful for
/// heterogeneous lists where the number of parameters greater than 16, or
/// homogenous lists of parameters where the number of parameters exceeds 32.
/// homogeneous lists of parameters where the number of parameters exceeds 32.
///
/// - For small homogeneous lists of parameters, they can either be passed as:
///
@ -194,7 +194,7 @@ pub trait Params: Sealed {
//
// This sadly prevents `impl<T: ToSql, const N: usize> Params for [T; N]`, which
// forces people to use `params![...]` or `rusqlite::params_from_iter` for long
// homogenous lists of parameters. This is not that big of a deal, but is
// homogeneous lists of parameters. This is not that big of a deal, but is
// unfortunate, especially because I mostly did it because I wanted a simple
// syntax for no-params that didnt require importing -- the empty tuple fits
// that nicely, but I didn't think of it until much later.

7
third_party/rust/rusqlite/src/pragma.rs поставляемый
Просмотреть файл

@ -70,6 +70,13 @@ impl Sql {
Some(format!("Unsupported value \"{value:?}\"")),
));
}
#[cfg(feature = "functions")]
ToSqlOutput::Arg(_) => {
return Err(Error::SqliteFailure(
ffi::Error::new(ffi::SQLITE_MISUSE),
Some(format!("Unsupported value \"{value:?}\"")),
));
}
#[cfg(feature = "array")]
ToSqlOutput::Array(_) => {
return Err(Error::SqliteFailure(

39
third_party/rust/rusqlite/src/row.rs поставляемый
Просмотреть файл

@ -14,9 +14,11 @@ pub struct Rows<'stmt> {
impl<'stmt> Rows<'stmt> {
#[inline]
fn reset(&mut self) {
fn reset(&mut self) -> Result<()> {
if let Some(stmt) = self.stmt.take() {
stmt.reset();
stmt.reset()
} else {
Ok(())
}
}
@ -105,6 +107,7 @@ impl<'stmt> Rows<'stmt> {
}
impl Drop for Rows<'_> {
#[allow(unused_must_use)]
#[inline]
fn drop(&mut self) {
self.reset();
@ -217,12 +220,12 @@ impl<'stmt> FallibleStreamingIterator for Rows<'stmt> {
Ok(())
}
Ok(false) => {
self.reset();
let r = self.reset();
self.row = None;
Ok(())
r
}
Err(e) => {
self.reset();
let _ = self.reset(); // prevents infinite loop on error
self.row = None;
Err(e)
}
@ -585,4 +588,30 @@ mod tests {
// We don't test one bigger because it's unimplemented
Ok(())
}
#[test]
#[cfg(feature = "bundled")]
fn pathological_case() -> Result<()> {
let conn = Connection::open_in_memory()?;
conn.execute_batch(
"CREATE TABLE foo(x);
CREATE TRIGGER oops BEFORE INSERT ON foo BEGIN SELECT RAISE(FAIL, 'Boom'); END;",
)?;
let mut stmt = conn.prepare("INSERT INTO foo VALUES (0) RETURNING rowid;")?;
{
let iterator_count = stmt.query_map([], |_| Ok(()))?.count();
assert_eq!(1, iterator_count); // should be 0
use fallible_streaming_iterator::FallibleStreamingIterator;
let fallible_iterator_count = stmt.query([])?.count().unwrap_or(0);
assert_eq!(0, fallible_iterator_count);
}
{
let iterator_last = stmt.query_map([], |_| Ok(()))?.last();
assert!(iterator_last.is_some()); // should be none
use fallible_iterator::FallibleIterator;
let fallible_iterator_last = stmt.query([])?.map(|_| Ok(())).last();
assert!(fallible_iterator_last.is_err());
}
Ok(())
}
}

25
third_party/rust/rusqlite/src/statement.rs поставляемый
Просмотреть файл

@ -606,6 +606,13 @@ impl Statement<'_> {
.conn
.decode_result(unsafe { ffi::sqlite3_bind_zeroblob(ptr, col as c_int, len) });
}
#[cfg(feature = "functions")]
ToSqlOutput::Arg(_) => {
return Err(Error::SqliteFailure(
ffi::Error::new(ffi::SQLITE_MISUSE),
Some(format!("Unsupported value \"{value:?}\"")),
));
}
#[cfg(feature = "array")]
ToSqlOutput::Array(a) => {
return self.conn.decode_result(unsafe {
@ -650,9 +657,12 @@ impl Statement<'_> {
fn execute_with_bound_parameters(&mut self) -> Result<usize> {
self.check_update()?;
let r = self.stmt.step();
self.stmt.reset();
let rr = self.stmt.reset();
match r {
ffi::SQLITE_DONE => Ok(self.conn.changes() as usize),
ffi::SQLITE_DONE => match rr {
ffi::SQLITE_OK => Ok(self.conn.changes() as usize),
_ => Err(self.conn.decode_result(rr).unwrap_err()),
},
ffi::SQLITE_ROW => Err(Error::ExecuteReturnedResults),
_ => Err(self.conn.decode_result(r).unwrap_err()),
}
@ -847,8 +857,11 @@ impl Statement<'_> {
}
#[inline]
pub(super) fn reset(&self) -> c_int {
self.stmt.reset()
pub(super) fn reset(&self) -> Result<()> {
match self.stmt.reset() {
ffi::SQLITE_OK => Ok(()),
code => Err(self.conn.decode_result(code).unwrap_err()),
}
}
}
@ -1274,7 +1287,7 @@ mod test {
assert_eq!(0, stmt.column_count());
stmt.parameter_index("test").unwrap();
stmt.step().unwrap_err();
stmt.reset();
stmt.reset().unwrap(); // SQLITE_OMIT_AUTORESET = false
stmt.execute([]).unwrap_err();
Ok(())
}
@ -1347,7 +1360,7 @@ mod test {
fn test_error_offset() -> Result<()> {
use crate::ffi::ErrorCode;
let db = Connection::open_in_memory()?;
let r = db.execute_batch("SELECT CURRENT_TIMESTANP;");
let r = db.execute_batch("SELECT INVALID_FUNCTION;");
match r.unwrap_err() {
Error::SqlInputError { error, offset, .. } => {
assert_eq!(error.code, ErrorCode::Unknown);

2
third_party/rust/rusqlite/src/types/mod.rs поставляемый
Просмотреть файл

@ -111,7 +111,7 @@ pub struct Null;
/// SQLite data types.
/// See [Fundamental Datatypes](https://sqlite.org/c3ref/c_blob.html).
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Type {
/// NULL
Null,

Просмотреть файл

@ -22,6 +22,11 @@ pub enum ToSqlOutput<'a> {
#[cfg_attr(docsrs, doc(cfg(feature = "blob")))]
ZeroBlob(i32),
/// n-th arg of an SQL scalar function
#[cfg(feature = "functions")]
#[cfg_attr(docsrs, doc(cfg(feature = "functions")))]
Arg(usize),
/// `feature = "array"`
#[cfg(feature = "array")]
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
@ -107,6 +112,8 @@ impl ToSql for ToSqlOutput<'_> {
#[cfg(feature = "blob")]
ToSqlOutput::ZeroBlob(i) => ToSqlOutput::ZeroBlob(i),
#[cfg(feature = "functions")]
ToSqlOutput::Arg(i) => ToSqlOutput::Arg(i),
#[cfg(feature = "array")]
ToSqlOutput::Array(ref a) => ToSqlOutput::Array(a.clone()),
})

3
third_party/rust/rusqlite/src/vtab/mod.rs поставляемый
Просмотреть файл

@ -373,6 +373,7 @@ bitflags::bitflags! {
/// Virtual table scan flags
/// See [Function Flags](https://sqlite.org/c3ref/c_index_scan_unique.html) for details.
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct IndexFlags: ::std::os::raw::c_int {
/// Default
const NONE = 0;
@ -703,7 +704,7 @@ impl Context {
#[inline]
pub fn set_result<T: ToSql>(&mut self, value: &T) -> Result<()> {
let t = value.to_sql()?;
unsafe { set_result(self.0, &t) };
unsafe { set_result(self.0, &[], &t) };
Ok(())
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"2a0d414052d959098dcb3c22fce0eb008710ab594a6d0e5c58056b2dd497a359","src/conn_ext.rs":"d4eddf906ecf5d45b8cf9e858751cc22e644e652f04560237f8de748a33d56f6","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"e900a4ebadad31b0a87cb8d7c3ed5aeb7325d4d380ae1d9174eff62c78facdcc","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"b2c120db4928c3e4abdd96405fd4c1016255699bdbc38c8cd60dbd3431fc0a12","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"1de254e20df724f74be6c6d3bd54c77c9dd8eb009ef0a33c2e0a15da8f5c2aa3","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}
{"files":{"Cargo.toml":"6765229acc1f06326b3ede93379d78d119aa78679567baf0bf7bdb5ec310522f","src/conn_ext.rs":"d4eddf906ecf5d45b8cf9e858751cc22e644e652f04560237f8de748a33d56f6","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"e900a4ebadad31b0a87cb8d7c3ed5aeb7325d4d380ae1d9174eff62c78facdcc","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"b2c120db4928c3e4abdd96405fd4c1016255699bdbc38c8cd60dbd3431fc0a12","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"1de254e20df724f74be6c6d3bd54c77c9dd8eb009ef0a33c2e0a15da8f5c2aa3","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}

2
third_party/rust/sql-support/Cargo.toml поставляемый
Просмотреть файл

@ -32,7 +32,7 @@ version = "0.10"
optional = true
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"functions",
"limits",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"05e4d7f7b3649a3e3fa441c4af53a633d18f20bb04fd761ed33fc9d461fd0dee","README.md":"dd0c0d3fc180f2021d81ea5804895f661cb4fe45b87fe5b1ebf8aa756988e867","benches/benchmark_all.rs":"c2343c9197b6d9ccb0798d7701b1b0d2569d494dd31a975d21d7ec6f26e32879","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/benchmarks/README.md":"ccee8dbddba8762d0453fa855bd6984137b224b8c019f3dd8e86a3c303f51d71","src/benchmarks/client.rs":"b65f3d53323c827ca55cc02442b63a137c783530cc93225a90b02bc4e9790d0f","src/benchmarks/ingest.rs":"8cce7a9162bc1080e58e7f18a27c64f74cb45598fa33d3c2579f30e9b0414d50","src/benchmarks/mod.rs":"fe1898ba4d783213525da10d92858ee84cebfd22749bad7aeb461d338fe5504a","src/bin/debug_ingestion_sizes.rs":"ce6e810be7b3fc19e826d75b622b82cfab5a1a99397a6d0833c2c4eebff2d364","src/config.rs":"d40c6e83d8b5faa32c66110803ca9e78611d43507e9d3f1e191a93a7773c37b3","src/db.rs":"f2c986a8255e8359ddabd70b3dbab50713d092f3e5dfe85581a60f24655c1686","src/error.rs":"d5e0ec57aefc19d3e0230bb8832ca6fa603a18feabfc3a3e0f06ac940cc4e45e","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"73887af023e223188f874d43ddf601784c93e9388a7adece79818d559a3366a1","src/pocket.rs":"1316668840ec9b4ea886223921dc9d3b5a1731d1a5206c0b1089f2a6c45c1b7b","src/provider.rs":"92eb1a9fa7d6814efe47fc3e7447e46bf6c0320d6fbef0d9170c46eab0e272ab","src/query.rs":"1084548b9dc0587322f08741e07db9413e9fa231166593bdbf47e562d31799a3","src/rs.rs":"0eabd6108fd1316265def15f9d232b2f70a72126019891bf4f52f5a8c6f72d1a","src/schema.rs":"88ff3ae6b652fa5a5cff4dc504d11a7fc33f1b2ee9716b970f646d9f9ca90ab7","src/store.rs":"f47de3b4da2677bdca8edd1b017f1580b9985f36d2d86b904e1058893c9f3445","src/suggest.udl":"4bfd70767a204dc58081be5d70ca96480b04b9acb741e6d2d8394362677f119d","src/suggestion.rs":"f31227779d13d1b03a622e08a417ceba4afb161885a01c2bc87a6a652b5e8be5","src/testing/client.rs":"855c14a2a5c5d9a33521c44dbb0d89f5ff531c5d125fb62d6491190c4c887df0","src/testing/data.rs":"dcd24d24997fe4f8c472f5b754a9a2b90b83e2632b4f13a77499e23441a6dea1","src/testing/mod.rs":"308c9e0f479b3d8ca6c206853842e42ce07721161f3dcc23b7018a7e4d687b03","src/yelp.rs":"bc036ff71b438d53ce8811acd8d650d83ef03faeea476f5b659b403c1e64ff2b","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}
{"files":{"Cargo.toml":"b2d2fb29d7408dd736650935a89627490c25ef813a5244ecd1bd9dad30e32b78","README.md":"dd0c0d3fc180f2021d81ea5804895f661cb4fe45b87fe5b1ebf8aa756988e867","benches/benchmark_all.rs":"c2343c9197b6d9ccb0798d7701b1b0d2569d494dd31a975d21d7ec6f26e32879","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/benchmarks/README.md":"ccee8dbddba8762d0453fa855bd6984137b224b8c019f3dd8e86a3c303f51d71","src/benchmarks/client.rs":"b65f3d53323c827ca55cc02442b63a137c783530cc93225a90b02bc4e9790d0f","src/benchmarks/ingest.rs":"8cce7a9162bc1080e58e7f18a27c64f74cb45598fa33d3c2579f30e9b0414d50","src/benchmarks/mod.rs":"fe1898ba4d783213525da10d92858ee84cebfd22749bad7aeb461d338fe5504a","src/bin/debug_ingestion_sizes.rs":"ce6e810be7b3fc19e826d75b622b82cfab5a1a99397a6d0833c2c4eebff2d364","src/config.rs":"d40c6e83d8b5faa32c66110803ca9e78611d43507e9d3f1e191a93a7773c37b3","src/db.rs":"f2c986a8255e8359ddabd70b3dbab50713d092f3e5dfe85581a60f24655c1686","src/error.rs":"d5e0ec57aefc19d3e0230bb8832ca6fa603a18feabfc3a3e0f06ac940cc4e45e","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"73887af023e223188f874d43ddf601784c93e9388a7adece79818d559a3366a1","src/pocket.rs":"1316668840ec9b4ea886223921dc9d3b5a1731d1a5206c0b1089f2a6c45c1b7b","src/provider.rs":"92eb1a9fa7d6814efe47fc3e7447e46bf6c0320d6fbef0d9170c46eab0e272ab","src/query.rs":"1084548b9dc0587322f08741e07db9413e9fa231166593bdbf47e562d31799a3","src/rs.rs":"0eabd6108fd1316265def15f9d232b2f70a72126019891bf4f52f5a8c6f72d1a","src/schema.rs":"88ff3ae6b652fa5a5cff4dc504d11a7fc33f1b2ee9716b970f646d9f9ca90ab7","src/store.rs":"f47de3b4da2677bdca8edd1b017f1580b9985f36d2d86b904e1058893c9f3445","src/suggest.udl":"4bfd70767a204dc58081be5d70ca96480b04b9acb741e6d2d8394362677f119d","src/suggestion.rs":"f31227779d13d1b03a622e08a417ceba4afb161885a01c2bc87a6a652b5e8be5","src/testing/client.rs":"855c14a2a5c5d9a33521c44dbb0d89f5ff531c5d125fb62d6491190c4c887df0","src/testing/data.rs":"dcd24d24997fe4f8c472f5b754a9a2b90b83e2632b4f13a77499e23441a6dea1","src/testing/mod.rs":"308c9e0f479b3d8ca6c206853842e42ce07721161f3dcc23b7018a7e4d687b03","src/yelp.rs":"bc036ff71b438d53ce8811acd8d650d83ef03faeea476f5b659b403c1e64ff2b","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}

2
third_party/rust/suggest/Cargo.toml поставляемый
Просмотреть файл

@ -49,7 +49,7 @@ path = "../support/interrupt"
path = "../remote_settings"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"functions",
"bundled",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"bddff80ee6b23b5f34db9230877035926fd6bd4a86f332aa14bfa6157a4eada6","src/lib.rs":"a112b66270feba587d0b09e64b4197af01f981675a23f76649a7d948f85c2bd9","src/rusqlite_support.rs":"827d314605d8c741efdf238a0780a891c88bc56026a3e6dcfa534772a4852fb3","src/serde_support.rs":"519b5eb59ca7be555d522f2186909db969069dc9586a5fe4047d4ec176b2368a"},"package":null}
{"files":{"Cargo.toml":"f64f49761ff16c3504292455d4a94f34456ce1605a545a7e8d53bddb12f581e4","src/lib.rs":"a112b66270feba587d0b09e64b4197af01f981675a23f76649a7d948f85c2bd9","src/rusqlite_support.rs":"827d314605d8c741efdf238a0780a891c88bc56026a3e6dcfa534772a4852fb3","src/serde_support.rs":"519b5eb59ca7be555d522f2186909db969069dc9586a5fe4047d4ec176b2368a"},"package":null}

2
third_party/rust/sync-guid/Cargo.toml поставляемый
Просмотреть файл

@ -25,7 +25,7 @@ version = "0.8"
optional = true
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = ["bundled"]
optional = true

2
third_party/rust/tabs/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"f6a1223015a53cae17cfd87256a72ec9fc4847f5fea2c71b14b7fdba074e9021","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"33e61b811b19ed2b58e319cc65d5988bed258d2c4fea2d706301184c59847a0f","src/error.rs":"2694657aeb12f99c4b2fe102ad2b08b79955d209201831b3e071129f0b7d7eda","src/lib.rs":"5789fc7107c76168c331c175aff4f0b2ac2ba3d65cfa0df0e1d4f8ef0c6eb80c","src/schema.rs":"510218d465c7d26d6b9f342cc33c14ab83044a67561ef924c33dadb060761972","src/storage.rs":"c5620d81cfafebc899b34d331ab249359c297745e977ae1416253008ff3ff8d3","src/store.rs":"7e93486b55af9b8e30f9dea9ea166e92993eeaa8bb15860edf25f034ab4c84d5","src/sync/bridge.rs":"18d3a7913a030b598d4b6cbd5b7e2ab4cef4cc7ea964f5bc84d7fb2f28787529","src/sync/engine.rs":"73007423f2a22314a034ac660aa65bd9c50e8aa850c445a66604486280067843","src/sync/mod.rs":"09ba3c87f1174a243bf5aaa481effd18929d54359ceb9b23ccb2c32ee3482f34","src/sync/record.rs":"eef6751c209d039958afbe245ddb006cfdf6b8b6b47f925f69c552b832b87922","src/tabs.udl":"b2918b26c982c3420346bad4c8de83fa039afcee5ab838c71048eae27240af8f","uniffi.toml":"f9125e8d55b109e86076ee88bfd640372f06b142b7db557e41816c7227dd445c"},"package":null}
{"files":{"Cargo.toml":"a3efcca6f5de8ea2b6cda1a99e3aa8782362acbd13866503c9a70750292585f4","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"33e61b811b19ed2b58e319cc65d5988bed258d2c4fea2d706301184c59847a0f","src/error.rs":"2694657aeb12f99c4b2fe102ad2b08b79955d209201831b3e071129f0b7d7eda","src/lib.rs":"5789fc7107c76168c331c175aff4f0b2ac2ba3d65cfa0df0e1d4f8ef0c6eb80c","src/schema.rs":"510218d465c7d26d6b9f342cc33c14ab83044a67561ef924c33dadb060761972","src/storage.rs":"c5620d81cfafebc899b34d331ab249359c297745e977ae1416253008ff3ff8d3","src/store.rs":"7e93486b55af9b8e30f9dea9ea166e92993eeaa8bb15860edf25f034ab4c84d5","src/sync/bridge.rs":"18d3a7913a030b598d4b6cbd5b7e2ab4cef4cc7ea964f5bc84d7fb2f28787529","src/sync/engine.rs":"73007423f2a22314a034ac660aa65bd9c50e8aa850c445a66604486280067843","src/sync/mod.rs":"09ba3c87f1174a243bf5aaa481effd18929d54359ceb9b23ccb2c32ee3482f34","src/sync/record.rs":"eef6751c209d039958afbe245ddb006cfdf6b8b6b47f925f69c552b832b87922","src/tabs.udl":"b2918b26c982c3420346bad4c8de83fa039afcee5ab838c71048eae27240af8f","uniffi.toml":"f9125e8d55b109e86076ee88bfd640372f06b142b7db557e41816c7227dd445c"},"package":null}

2
third_party/rust/tabs/Cargo.toml поставляемый
Просмотреть файл

@ -39,7 +39,7 @@ path = "../support/error"
path = "../support/interrupt"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"bundled",
"unlock_notify",

2
third_party/rust/types/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"ff403fc27b2a212bd4c4d33401c975e73400fd3d8a6aa7d0c1fada35f9560d89","src/lib.rs":"0ce1fe3683f2285fea2d67975e53d121b69c23bf901a5b1d428919e5ce67a7ba"},"package":null}
{"files":{"Cargo.toml":"2f27d63e4c01b357abd1a53a6ebd4e6f5ea861c01fb93f61547f6a0f802c0599","src/lib.rs":"0ce1fe3683f2285fea2d67975e53d121b69c23bf901a5b1d428919e5ce67a7ba"},"package":null}

2
third_party/rust/types/Cargo.toml поставляемый
Просмотреть файл

@ -22,7 +22,7 @@ serde_derive = "1"
serde_json = "1"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"functions",
"bundled",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"b20c30e7d9ae0460d04b744d5a9274985ded6e5b9ed0262b914553ca71425821","README.md":"821cac7eb5b963fc3f3fe21dd890427ab2bbf335cb25cbae89b713b3350687c5","build.rs":"92f7d380f3d8fab1e6d80276915af57192e276321d132a5f800ea4520e9cb469","sql/create_schema.sql":"a17311a407ec10e033886b7125da4c8b84bc6d761f6b28edc9594de430e1d964","sql/create_sync_temp_tables.sql":"860ede362c94feb47d85522553fa2852f9bdb9f9b025d6438dd5dee3d4acd527","sql/tests/create_schema_v1.sql":"77cf0c90eaac3e1aea626537147e1b8ec349b68d6076c92fa7ae402aac613050","src/api.rs":"6fe362e4f437def2ad2249de385cca8f0d1d5d67679240351e9f57523fefe5e7","src/db.rs":"04ef67021b6aad7552a268397c7323302c4f619b3fb07fb140132beb8b37f8b5","src/error.rs":"8587813be8e2a7f5efad4216a5c4686554ed44e98cf94bfd9c2f2c9adc8e9a11","src/ffi.rs":"f66a81393bebe7a4b7e7960cb426df106ff1f02bfebcaa6e335b4b8b56c5c936","src/lib.rs":"ab25e7c6ea67fb905fe6dad866c0d2c462b1e93bcff283db947513aeabbb2d73","src/migration.rs":"8d92f82b2ba38e1039fd054c8c75078a6b896a0d3cdc1a52571456b25a32c9c3","src/schema.rs":"d8dd8f66cad71e3e369722734e0d5d16fd9423d5f6a5abba1854a27e1e814724","src/store.rs":"d208689c46fb97cd2c60a0c610ba1998a7132fb50fffa2eefa1d6b169b7c34f0","src/sync/bridge.rs":"996de05beb2904f84b3cbfc9ef85c4844078fdb4867d9068390d496156bee614","src/sync/incoming.rs":"dd77c64e2ade4f39cba258decab6d3db8ad0b5f513aa018efbd56b9869a021d9","src/sync/mod.rs":"05da064e1bc2cc449c806a534842da92d8d4b24a919f2dff2e88dc69f3e926a5","src/sync/outgoing.rs":"dacb77b956f2546fd60a89367927a199d9b662b17201d0781145f7405b61fdce","src/sync/sync_tests.rs":"f3846ca7e463315ba9788826613b987ddcff7b21672ff257a98769ee94f4191a","src/webext-storage.udl":"0341d431ba837cf64ea210ef6157010c6664a0b5a194e89acb0414938636b391","uniffi.toml":"beeec89c2f877eb89be0090dc304dbc7c74e787385e7459bad78c6165bb66791"},"package":null}
{"files":{"Cargo.toml":"5129b4a9a3c9074f32271928b342e236378d92a8c040370ca38aeb577b58ba05","README.md":"821cac7eb5b963fc3f3fe21dd890427ab2bbf335cb25cbae89b713b3350687c5","build.rs":"92f7d380f3d8fab1e6d80276915af57192e276321d132a5f800ea4520e9cb469","sql/create_schema.sql":"a17311a407ec10e033886b7125da4c8b84bc6d761f6b28edc9594de430e1d964","sql/create_sync_temp_tables.sql":"860ede362c94feb47d85522553fa2852f9bdb9f9b025d6438dd5dee3d4acd527","sql/tests/create_schema_v1.sql":"77cf0c90eaac3e1aea626537147e1b8ec349b68d6076c92fa7ae402aac613050","src/api.rs":"6fe362e4f437def2ad2249de385cca8f0d1d5d67679240351e9f57523fefe5e7","src/db.rs":"04ef67021b6aad7552a268397c7323302c4f619b3fb07fb140132beb8b37f8b5","src/error.rs":"8587813be8e2a7f5efad4216a5c4686554ed44e98cf94bfd9c2f2c9adc8e9a11","src/ffi.rs":"f66a81393bebe7a4b7e7960cb426df106ff1f02bfebcaa6e335b4b8b56c5c936","src/lib.rs":"ab25e7c6ea67fb905fe6dad866c0d2c462b1e93bcff283db947513aeabbb2d73","src/migration.rs":"8d92f82b2ba38e1039fd054c8c75078a6b896a0d3cdc1a52571456b25a32c9c3","src/schema.rs":"d8dd8f66cad71e3e369722734e0d5d16fd9423d5f6a5abba1854a27e1e814724","src/store.rs":"d208689c46fb97cd2c60a0c610ba1998a7132fb50fffa2eefa1d6b169b7c34f0","src/sync/bridge.rs":"996de05beb2904f84b3cbfc9ef85c4844078fdb4867d9068390d496156bee614","src/sync/incoming.rs":"dd77c64e2ade4f39cba258decab6d3db8ad0b5f513aa018efbd56b9869a021d9","src/sync/mod.rs":"05da064e1bc2cc449c806a534842da92d8d4b24a919f2dff2e88dc69f3e926a5","src/sync/outgoing.rs":"dacb77b956f2546fd60a89367927a199d9b662b17201d0781145f7405b61fdce","src/sync/sync_tests.rs":"f3846ca7e463315ba9788826613b987ddcff7b21672ff257a98769ee94f4191a","src/webext-storage.udl":"0341d431ba837cf64ea210ef6157010c6664a0b5a194e89acb0414938636b391","uniffi.toml":"beeec89c2f877eb89be0090dc304dbc7c74e787385e7459bad78c6165bb66791"},"package":null}

4
third_party/rust/webext-storage/Cargo.toml поставляемый
Просмотреть файл

@ -37,7 +37,7 @@ path = "../support/error"
path = "../support/interrupt"
[dependencies.rusqlite]
version = "0.30.0"
version = "0.31.0"
features = [
"functions",
"bundled",
@ -64,7 +64,7 @@ version = "2.1"
features = ["serde"]
[dev-dependencies]
libsqlite3-sys = "0.27.0"
libsqlite3-sys = "0.28.0"
tempfile = "3"
[dev-dependencies.env_logger]