mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1854031 - Part 6. Run ./mach vendor rust. r=TYLin,supply-chain-reviewers
Depends on D193881 Differential Revision: https://phabricator.services.mozilla.com/D193882
This commit is contained in:
parent
e3d0505cbb
commit
ef0c3cc7c9
@ -95,11 +95,6 @@ git = "https://github.com/mozilla/uniffi-rs.git"
|
||||
rev = "c0e64b839018728d8153ce1758d391b7782e2e21"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/rust-diplomat/diplomat?rev=8d125999893fedfdf30595e97334c21ec4b18da9"]
|
||||
git = "https://github.com/rust-diplomat/diplomat"
|
||||
rev = "8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/rust-lang/rust-bindgen?rev=86f3dbe846020e2ba573d6eb38d1434d0cbcbb40"]
|
||||
git = "https://github.com/rust-lang/rust-bindgen"
|
||||
rev = "86f3dbe846020e2ba573d6eb38d1434d0cbcbb40"
|
||||
@ -110,11 +105,6 @@ git = "https://github.com/servo/rust-cssparser"
|
||||
rev = "aaa966d9d6ae70c4b8a62bb5e3a14c068bb7dff0"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/unicode-org/icu4x?rev=14e9a3a9857be74582abe2dfa7ab799c5eaac873"]
|
||||
git = "https://github.com/unicode-org/icu4x"
|
||||
rev = "14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
|
||||
# Take advantage of the fact that cargo will treat lines starting with #
|
||||
# as comments to add preprocessing directives. This file can thus by copied
|
||||
|
124
Cargo.lock
generated
124
Cargo.lock
generated
@ -885,6 +885,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_maths"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3"
|
||||
dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "coreaudio-sys"
|
||||
version = "0.2.14"
|
||||
@ -1341,8 +1350,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "diplomat"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/rust-diplomat/diplomat?rev=8d125999893fedfdf30595e97334c21ec4b18da9#8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31672b3ebc3c7866c3c98726f7a9a5ac8f13962e77d3c8225f6be49a7b8c5f2"
|
||||
dependencies = [
|
||||
"diplomat_core",
|
||||
"proc-macro2",
|
||||
@ -1352,13 +1362,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "diplomat-runtime"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/rust-diplomat/diplomat?rev=8d125999893fedfdf30595e97334c21ec4b18da9#8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7b0f23d549a46540e26e5490cd44c64ced0d762959f1ffdec6ab0399634cf3c"
|
||||
|
||||
[[package]]
|
||||
name = "diplomat_core"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/rust-diplomat/diplomat?rev=8d125999893fedfdf30595e97334c21ec4b18da9#8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfaa5e13e8b8735d2338f2836c06cd8643902ab87dda1dd07dbb351998ddc127"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"proc-macro2",
|
||||
@ -2629,9 +2641,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_capi"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c29e1e7407081a5e425b295ef28526ca4c3cd7ce4475e1769c2863bb18b9305"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"diplomat",
|
||||
"diplomat-runtime",
|
||||
@ -2639,17 +2649,15 @@ dependencies = [
|
||||
"icu_provider",
|
||||
"icu_provider_adapters",
|
||||
"icu_segmenter",
|
||||
"icu_testdata",
|
||||
"log",
|
||||
"tinystr",
|
||||
"writeable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_collections"
|
||||
version = "1.2.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef8302d8dfd6044d3ddb3f807a5ef3d7bbca9a574959c6d6e4dc39aa7012d0d5"
|
||||
checksum = "137d96353afc8544d437e8a99eceb10ab291352699573b0de5b08bda38c78c60"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"yoke",
|
||||
@ -2659,9 +2667,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_locid"
|
||||
version = "1.2.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3003f85dccfc0e238ff567693248c59153a46f4e6125ba4020b973cef4d1d335"
|
||||
checksum = "5c0aa2536adc14c07e2a521e95512b75ed8ef832f0fdf9299d4a0a45d2be2a9d"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"litemap",
|
||||
@ -2671,15 +2679,29 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider"
|
||||
version = "1.2.0"
|
||||
name = "icu_locid_transform"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dc312a7b6148f7dfe098047ae2494d12d4034f48ade58d4f353000db376e305"
|
||||
checksum = "57c17d8f6524fdca4471101dd71f0a132eb6382b5d6d7f2970441cb25f6f435a"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"icu_locid",
|
||||
"icu_provider",
|
||||
"tinystr",
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba58e782287eb6950247abbf11719f83f5d4e4a5c1f2cd490d30a334bc47c2f4"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"icu_locid",
|
||||
"icu_provider_macros",
|
||||
"stable_deref_trait",
|
||||
"tinystr",
|
||||
"writeable",
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
@ -2688,21 +2710,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider_adapters"
|
||||
version = "1.2.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4ae1e2bd0c41728b77e7c46e9afdec5e2127d1eedacc684724667d50c126bd3"
|
||||
checksum = "a229f978260da7c3aabb68cb7dc7316589936680570fe55e50fdd3f97711a4dd"
|
||||
dependencies = [
|
||||
"icu_locid",
|
||||
"icu_locid_transform",
|
||||
"icu_provider",
|
||||
"tinystr",
|
||||
"yoke",
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider_macros"
|
||||
version = "1.2.0"
|
||||
source = "git+https://github.com/unicode-org/icu4x?rev=14e9a3a9857be74582abe2dfa7ab799c5eaac873#14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2abdd3a62551e8337af119c5899e600ca0c88ec8f23a46c60ba216c803dcf1a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2711,30 +2734,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_segmenter"
|
||||
version = "1.2.1"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3300a7b6bf187be98a57264ad094f11f2e062c2e8263132af010ff522ee5495"
|
||||
checksum = "b2dc1e8f4ba33a6a4956770ac5c08570f255d6605519fb3a859a0c0a270a2f8f"
|
||||
dependencies = [
|
||||
"core_maths",
|
||||
"displaydoc",
|
||||
"icu_collections",
|
||||
"icu_locid",
|
||||
"icu_provider",
|
||||
"num-traits",
|
||||
"icu_segmenter_data",
|
||||
"utf8_iter",
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_testdata"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"icu_collections",
|
||||
"icu_locid",
|
||||
"icu_provider",
|
||||
"icu_provider_adapters",
|
||||
"icu_segmenter",
|
||||
"zerovec",
|
||||
]
|
||||
name = "icu_segmenter_data"
|
||||
version = "1.4.0"
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
@ -3178,9 +3194,9 @@ checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.7.0"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a04a5b2b6f54acba899926491d0a6c59d98012938ca2ab5befb281c034e8f94"
|
||||
checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da"
|
||||
|
||||
[[package]]
|
||||
name = "lmdb-rkv"
|
||||
@ -5551,9 +5567,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tinystr"
|
||||
version = "0.7.1"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ac3f5b6856e931e15e07b478e98c8045239829a65f9156d4fa7e7788197a5ef"
|
||||
checksum = "d5d0e245e80bdc9b4e5356fc45a72184abbc3861992603f515270e9340f5a219"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"zerovec",
|
||||
@ -6585,9 +6601,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "writeable"
|
||||
version = "0.5.2"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60e49e42bdb1d5dc76f4cd78102f8f0714d32edfa3efb82286eb0f0b1fc0da0f"
|
||||
checksum = "dad7bb64b8ef9c0aa27b6da38b452b0ee9fd82beaf276a87dd796fb55cbae14e"
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
@ -6649,9 +6665,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.7.1"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1848075a23a28f9773498ee9a0f2cf58fcbad4f8c0ccf84a210ab33c6ae495de"
|
||||
checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"stable_deref_trait",
|
||||
@ -6661,8 +6677,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke-derive"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/unicode-org/icu4x?rev=14e9a3a9857be74582abe2dfa7ab799c5eaac873#14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -6692,8 +6709,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom-derive"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/unicode-org/icu4x?rev=14e9a3a9857be74582abe2dfa7ab799c5eaac873#14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6a647510471d372f2e6c2e6b7219e44d8c574d24fdc11c610a61455782f18c3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -6703,9 +6721,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec"
|
||||
version = "0.9.4"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "198f54134cd865f437820aa3b43d0ad518af4e68ee161b444cdd15d8e567c8ea"
|
||||
checksum = "eff4439ae91fb5c72b8abc12f3f2dbf51bd27e6eadb9f8a5bc8898dddb0e27ea"
|
||||
dependencies = [
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
@ -6714,13 +6732,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec-derive"
|
||||
version = "0.9.4"
|
||||
source = "git+https://github.com/unicode-org/icu4x?rev=14e9a3a9857be74582abe2dfa7ab799c5eaac873#14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b4e5997cbf58990550ef1f0e5124a05e47e1ebd33a84af25739be6031a62c20"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -881,6 +881,11 @@ parameter. These are directly parallel to the existing versions without CTFontOp
|
||||
introduce any new forms of risk.
|
||||
"""
|
||||
|
||||
[[audits.core_maths]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.1.0"
|
||||
|
||||
[[audits.coreaudio-sys]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -1313,6 +1318,11 @@ who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.5.2@git:8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
|
||||
[[audits.diplomat]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.7.0"
|
||||
|
||||
[[audits.diplomat-runtime]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -1324,6 +1334,11 @@ who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.5.2@git:8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
|
||||
[[audits.diplomat-runtime]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.7.0"
|
||||
|
||||
[[audits.diplomat_core]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -1335,6 +1350,11 @@ who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.5.2@git:8d125999893fedfdf30595e97334c21ec4b18da9"
|
||||
|
||||
[[audits.diplomat_core]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.7.0"
|
||||
|
||||
[[audits.displaydoc]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -1981,30 +2001,61 @@ criteria = "safe-to-deploy"
|
||||
version = "1.2.2"
|
||||
notes = "This crate is C/C++ FFI for ICU4X using diplomat crate. no unsafe and no file access etc on this crate."
|
||||
|
||||
[[audits.icu_capi]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.2 -> 1.4.0"
|
||||
|
||||
[[audits.icu_collections]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.0"
|
||||
notes = "This crate is used by ICU4X for internal data structure. There is no fileaccess and network access. This uses unsafe block, but we confirm data is valid before."
|
||||
|
||||
[[audits.icu_collections]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.4.0"
|
||||
|
||||
[[audits.icu_locid]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.0"
|
||||
notes = "This has unsafe block to handle ascii string in utf-8 string. I've vetted the one instance of unsafe code."
|
||||
|
||||
[[audits.icu_locid]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.4.0"
|
||||
|
||||
[[audits.icu_locid_transform]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.4.0"
|
||||
notes = "This crate doesn't contain network and file access. Although this has unsafe block, the reason is added in the comment block. I audited code."
|
||||
|
||||
[[audits.icu_provider]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.0"
|
||||
notes = "Although this has unsafe block, this has a commnet why this is safety and I audited code. Also, this doesn't have file access and network access."
|
||||
|
||||
[[audits.icu_provider]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.4.0"
|
||||
|
||||
[[audits.icu_provider_adapters]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.0"
|
||||
notes = "This is one of ICU4X data provider crates that depends on data type. This has no unsafe code and uses no ambient capabilities."
|
||||
|
||||
[[audits.icu_provider_adapters]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.4.0"
|
||||
|
||||
[[audits.icu_provider_macros]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -2016,17 +2067,27 @@ who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.2.0@git:14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
|
||||
[[audits.icu_provider_macros]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.2.0 -> 1.4.0"
|
||||
|
||||
[[audits.icu_segmenter]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.1"
|
||||
notes = "Original authors are Makoto Kato and Ting-Yu Lin who work at Mozilla. This crate uses unsafe to matrix calculation, but it is safety to check length. And there is no filesystem / network access."
|
||||
|
||||
[[audits.icu_testdata]]
|
||||
[[audits.icu_segmenter]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.2.0"
|
||||
notes = "This is just ICU4X data only that is generated by ICU4X datagen. Generated data is in unsafe block to use zero-copy implmentation, but it is safety."
|
||||
delta = "1.2.1 -> 1.4.0"
|
||||
|
||||
[[audits.icu_segmenter_data]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "1.4.0"
|
||||
notes = "This crate is data only for icu_segmenter. There is no filesystem / network access."
|
||||
|
||||
[[audits.idna]]
|
||||
who = "Bobby Holley <bobbyholley@gmail.com>"
|
||||
@ -2167,6 +2228,11 @@ criteria = "safe-to-deploy"
|
||||
version = "0.7.0"
|
||||
notes = "This crete has no unsafe code, no file acceess and no network access."
|
||||
|
||||
[[audits.litemap]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.7.0 -> 0.7.2"
|
||||
|
||||
[[audits.lmdb-rkv]]
|
||||
who = "Bobby Holley <bobbyholley@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -3569,6 +3635,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.7.0 -> 0.7.1"
|
||||
|
||||
[[audits.tinystr]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.7.1 -> 0.7.4"
|
||||
|
||||
[[audits.tokio-macros]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
@ -4365,6 +4436,11 @@ criteria = "safe-to-deploy"
|
||||
version = "0.5.2"
|
||||
notes = "writeable is a variation of fmt::Write with sink version. This uses `unsafe` block to handle potentially-invalid UTF-8 character. I've vetted the one instance of unsafe code."
|
||||
|
||||
[[audits.writeable]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.2 -> 0.5.4"
|
||||
|
||||
[[audits.xmldecl]]
|
||||
who = "Henri Sivonen <hsivonen@hsivonen.fi>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4377,12 +4453,22 @@ criteria = "safe-to-deploy"
|
||||
version = "0.7.1"
|
||||
notes = "This crate is for zero-copy serialization for ICU4X data structure, and maintained by ICU4X team. Since this uses unsafe block for serialization, I audited code."
|
||||
|
||||
[[audits.yoke]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.7.1 -> 0.7.3"
|
||||
|
||||
[[audits.yoke-derive]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.7.1@git:14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
notes = "This crate is a helper for yoke crate that is ICU4X data structure, and maintained by ICU4X team. Since this uses unsafe block for serialization, all has the comment why this uses unsafe and I audited code."
|
||||
|
||||
[[audits.yoke-derive]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.7.3"
|
||||
|
||||
[[audits.zerofrom]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
@ -4395,18 +4481,33 @@ criteria = "safe-to-deploy"
|
||||
version = "0.1.2@git:14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
notes = "This is custom derives for `ZeroFrom` that is from zerofrom crate. This has no unsafe code and uses no ambient capabilities."
|
||||
|
||||
[[audits.zerofrom-derive]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.1.3"
|
||||
|
||||
[[audits.zerovec]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.9.4"
|
||||
notes = "This crate is zero-copy data structure implmentation. Although this uses unsafe block in several code, it requires for zero-copy. And this has a comment in code why this uses unsafe and I audited code."
|
||||
|
||||
[[audits.zerovec]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.9.4 -> 0.10.1"
|
||||
|
||||
[[audits.zerovec-derive]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.9.4@git:14e9a3a9857be74582abe2dfa7ab799c5eaac873"
|
||||
notes = "This is custom derives for `ZeroVec` that is from zerovec crate. Although this uses unsafe block for zero-copy, this has a comment in code why this uses unsafe and I audited code."
|
||||
|
||||
[[audits.zerovec-derive]]
|
||||
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
|
||||
criteria = "safe-to-deploy"
|
||||
version = "0.10.1"
|
||||
|
||||
[[audits.zip]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
|
@ -55,18 +55,6 @@ notes = "Upstream release plus a couple unpublished changes"
|
||||
audit-as-crates-io = true
|
||||
notes = "Part of the wgpu repository, pinned as the rest of wgpu crates."
|
||||
|
||||
[policy.diplomat]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[policy.diplomat-runtime]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[policy.diplomat_core]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[policy.firefox-on-glean]
|
||||
audit-as-crates-io = false
|
||||
notes = "The crates.io version of this is just a placeholder to allow public crates to depend on firefox-on-glean."
|
||||
@ -92,13 +80,13 @@ notes = "Used for fuzzing."
|
||||
criteria = "safe-to-run"
|
||||
notes = "Used for testing."
|
||||
|
||||
[policy.icu_provider_macros]
|
||||
[policy.icu_capi]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
notes = "Patched version of upstream"
|
||||
|
||||
[policy.icu_testdata]
|
||||
audit-as-crates-io = false
|
||||
notes = "Customized ICU4X baked data only that Gecko wants"
|
||||
[policy.icu_segmenter_data]
|
||||
audit-as-crates-io = true
|
||||
notes = "Patched version of upstream"
|
||||
|
||||
[policy.l10nregistry]
|
||||
dependency-criteria = { fluent-testing = "safe-to-run", tokio = "safe-to-run" }
|
||||
@ -238,18 +226,6 @@ notes = "Upstream project which we pin."
|
||||
[policy.wr_malloc_size_of]
|
||||
audit-as-crates-io = false
|
||||
|
||||
[policy.yoke-derive]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[policy.zerofrom-derive]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[policy.zerovec-derive]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream version not to use syn 1.x"
|
||||
|
||||
[[exemptions.ahash]]
|
||||
version = "0.7.6"
|
||||
criteria = "safe-to-deploy"
|
||||
|
1
third_party/rust/core_maths/.cargo-checksum.json
vendored
Normal file
1
third_party/rust/core_maths/.cargo-checksum.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"files":{"Cargo.toml":"731a42549f473035217f2a7dd8406fdb938133a86e280750e8af66ecd5400f6c","README.md":"cf4421c888471876bf715ce49aabe59ace32d165b1cd9878fa8d8f5ecd005fc1","src/lib.rs":"3ccbc7d11f612c33b8e5beb966ebda4aee777132ac1568c6a9f77a3d5fe08fda"},"package":"e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3"}
|
27
third_party/rust/core_maths/Cargo.toml
vendored
Normal file
27
third_party/rust/core_maths/Cargo.toml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
name = "core_maths"
|
||||
version = "0.1.0"
|
||||
authors = ["Robert Bastian <me@robertbastian.dev"]
|
||||
description = "Extension trait for full float functionality in `#[no_std]` backed by `libm`."
|
||||
readme = "README.md"
|
||||
categories = [
|
||||
"no-std",
|
||||
"mathematics",
|
||||
"api-bindings",
|
||||
]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/robertbastian/core_maths"
|
||||
|
||||
[dependencies.libm]
|
||||
version = "0.2"
|
16
third_party/rust/core_maths/README.md
vendored
Normal file
16
third_party/rust/core_maths/README.md
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<!-- cargo-rdme start -->
|
||||
|
||||
Extension trait for full float functionality in `#[no_std]` backed by [`libm`].
|
||||
|
||||
Method signatures, implementation, and documentation are copied from as `std` 1.72,
|
||||
with calls to instrinsics replaced by their `libm` equivalents.
|
||||
|
||||
# Usage
|
||||
```rust
|
||||
#[allow(unused_imports)] // will be unused on std targets
|
||||
use core_maths::*;
|
||||
|
||||
3.9.floor();
|
||||
```
|
||||
|
||||
<!-- cargo-rdme end -->
|
1221
third_party/rust/core_maths/src/lib.rs
vendored
Normal file
1221
third_party/rust/core_maths/src/lib.rs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"7fc35f8643067872335fe85cf4a6a4289c1b82156cf1216d223b44513b8d0d98","LICENSE-APACHE":"639c20c7f14fb122750d5ad1a6cfb116d9bf8d103e709ee40949e5a12a731666","LICENSE-MIT":"3337fe6e4a3830ad87c23cb9d6d750f9a1e5c45efc08de9c76c1a207fc6966c4","src/lib.rs":"6c019d412bb5534abd3869a16574599dcff730b89a576c3cf4c5590a1d449d17","src/result.rs":"2b07ce3cbb02a141abc35742f307cc4ef2b097ce610e04d92a50c469f354401d","src/wasm_glue.rs":"f26aa119aa291a3cfafc16b73f713a391718294a51e2c656d0093cf1fd2befac","src/writeable.rs":"80d8a93feba545fcb3150b8daf546f3e060b0c8c11f13917409dd455abe0c3bd"},"package":null}
|
||||
{"files":{"Cargo.toml":"ea77755aae387e62c45564000302e3c7a5ceda3be2f9ef8664e26ee871627b88","LICENSE-APACHE":"639c20c7f14fb122750d5ad1a6cfb116d9bf8d103e709ee40949e5a12a731666","LICENSE-MIT":"3337fe6e4a3830ad87c23cb9d6d750f9a1e5c45efc08de9c76c1a207fc6966c4","src/lib.rs":"1f42457d57ec23fd89f05af631eb73728f37a9790cd604ce1ce94ef153869fb0","src/result.rs":"2b07ce3cbb02a141abc35742f307cc4ef2b097ce610e04d92a50c469f354401d","src/wasm_glue.rs":"3712ccddfeacb98a37be9354a315cc013d9b6ba0bf2f351e0a806112d1f87c15","src/writeable.rs":"80d8a93feba545fcb3150b8daf546f3e060b0c8c11f13917409dd455abe0c3bd"},"package":"f7b0f23d549a46540e26e5490cd44c64ced0d762959f1ffdec6ab0399634cf3c"}
|
8
third_party/rust/diplomat-runtime/Cargo.toml
vendored
8
third_party/rust/diplomat-runtime/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "diplomat-runtime"
|
||||
version = "0.5.2"
|
||||
version = "0.7.0"
|
||||
authors = [
|
||||
"Shadaj Laddad <shadaj@users.noreply.github.com>",
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
@ -25,10 +25,12 @@ keywords = [
|
||||
"codegen",
|
||||
]
|
||||
categories = ["development-tools"]
|
||||
license = "MIT/Apache-2.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-diplomat/diplomat"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
[dependencies.log]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
|
3
third_party/rust/diplomat-runtime/src/lib.rs
vendored
3
third_party/rust/diplomat-runtime/src/lib.rs
vendored
@ -5,9 +5,8 @@ extern crate alloc;
|
||||
use alloc::alloc::Layout;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
// defines `extern "C" diplomat_init()`
|
||||
mod wasm_glue;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use wasm_glue::{console_log, console_trace, console_warn};
|
||||
|
||||
mod writeable;
|
||||
pub use writeable::DiplomatWriteable;
|
||||
|
129
third_party/rust/diplomat-runtime/src/wasm_glue.rs
vendored
129
third_party/rust/diplomat-runtime/src/wasm_glue.rs
vendored
@ -1,43 +1,94 @@
|
||||
// minimal WASM logger based on https://github.com/DeMille/wasm-glue
|
||||
extern "C" {
|
||||
fn trace_js(ptr: *const u8, len: usize);
|
||||
fn warn_js(ptr: *const u8, len: usize);
|
||||
fn log_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
|
||||
/// Throw an exception.
|
||||
pub fn console_trace(msg: &str) {
|
||||
unsafe {
|
||||
trace_js(msg.as_ptr(), msg.len());
|
||||
}
|
||||
}
|
||||
|
||||
/// Write a message to `console.warn`.
|
||||
pub fn console_warn(msg: &str) {
|
||||
unsafe { warn_js(msg.as_ptr(), msg.len()) }
|
||||
}
|
||||
|
||||
/// Write a message to `console.log`.
|
||||
pub fn console_log(msg: &str) {
|
||||
unsafe { log_js(msg.as_ptr(), msg.len()) }
|
||||
}
|
||||
use alloc::format;
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn diplomat_init() {
|
||||
unsafe extern "C" fn diplomat_init() {
|
||||
#[cfg(debug_assertions)]
|
||||
// Sets a custom panic hook using `trace_js`, which by default crates a JS error
|
||||
std::panic::set_hook(Box::new(|info| {
|
||||
let file = info.location().unwrap().file();
|
||||
let line = info.location().unwrap().line();
|
||||
let col = info.location().unwrap().column();
|
||||
|
||||
let msg = match info.payload().downcast_ref::<&'static str>() {
|
||||
Some(&s) => s,
|
||||
None => match info.payload().downcast_ref::<String>() {
|
||||
Some(s) => s.as_str(),
|
||||
None => "Box<Any>",
|
||||
},
|
||||
};
|
||||
console_trace(&format!("Panicked at '{msg}', {file}:{line}:{col}"));
|
||||
}));
|
||||
std::panic::set_hook(Box::new(panic_handler));
|
||||
#[cfg(feature = "log")]
|
||||
log::set_logger(&ConsoleLogger)
|
||||
.map(|()| log::set_max_level(log::LevelFilter::Debug))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn panic_handler(info: &PanicInfo) {
|
||||
let msg = match info.payload().downcast_ref::<&'static str>() {
|
||||
Some(&s) => s,
|
||||
None => match info.payload().downcast_ref::<String>() {
|
||||
Some(s) => s.as_str(),
|
||||
None => "Box<Any>",
|
||||
},
|
||||
};
|
||||
|
||||
let msg = match info.location() {
|
||||
Some(l) => format!(
|
||||
"wasm panicked at {}:{}:{}:\n{msg}",
|
||||
l.file(),
|
||||
l.line(),
|
||||
l.column(),
|
||||
),
|
||||
None => format!("wasm panicked at <unknown location>:\n{msg}"),
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
fn diplomat_throw_error_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
|
||||
unsafe { diplomat_throw_error_js(msg.as_ptr(), msg.len()) }
|
||||
}
|
||||
|
||||
#[cfg(feature = "log")]
|
||||
struct ConsoleLogger;
|
||||
|
||||
#[cfg(feature = "log")]
|
||||
impl log::Log for ConsoleLogger {
|
||||
#[inline]
|
||||
fn enabled(&self, metadata: &log::Metadata) -> bool {
|
||||
metadata.level() <= log::max_level()
|
||||
}
|
||||
|
||||
fn log(&self, record: &log::Record) {
|
||||
if !self.enabled(record.metadata()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let out = match record.level() {
|
||||
log::Level::Error => {
|
||||
extern "C" {
|
||||
fn diplomat_console_error_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
diplomat_console_error_js
|
||||
}
|
||||
log::Level::Warn => {
|
||||
extern "C" {
|
||||
fn diplomat_console_warn_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
diplomat_console_warn_js
|
||||
}
|
||||
log::Level::Info => {
|
||||
extern "C" {
|
||||
fn diplomat_console_info_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
diplomat_console_info_js
|
||||
}
|
||||
log::Level::Debug => {
|
||||
extern "C" {
|
||||
fn diplomat_console_log_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
diplomat_console_log_js
|
||||
}
|
||||
log::Level::Trace => {
|
||||
extern "C" {
|
||||
fn diplomat_console_debug_js(ptr: *const u8, len: usize);
|
||||
}
|
||||
diplomat_console_debug_js
|
||||
}
|
||||
};
|
||||
|
||||
let msg = alloc::format!("{}", record.args());
|
||||
|
||||
unsafe { out(msg.as_ptr(), msg.len()) };
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"8ae49bf1abfabd0c4013a0629f806795773baeca9e99605e485c6d9060d5f18e","LICENSE-APACHE":"639c20c7f14fb122750d5ad1a6cfb116d9bf8d103e709ee40949e5a12a731666","LICENSE-MIT":"3337fe6e4a3830ad87c23cb9d6d750f9a1e5c45efc08de9c76c1a207fc6966c4","src/enum_convert.rs":"c0068cb8b563043030186cd9a0be6a4eac1a5f1761fe3646a99528e6d3dc5f54","src/lib.rs":"e606ade5f7cc5b43f56b07511b34fe5c0eb2e53640a347d17585062bf9cdea7c","src/snapshots/diplomat__tests__cfgd_struct.snap":"2874497e83ba3f43541d90869bfa428973c5b23df7fec2826e187d530f1a620b","src/snapshots/diplomat__tests__cfged_method-2.snap":"45f4c58a153cfc8a01d24fcd4474cd7ff84e34ed8b75e718143c16edd884c510","src/snapshots/diplomat__tests__cfged_method.snap":"b478d2d14e01209b45032b092bf91a2068f08f704b2395bc3ebd2ada21141077","src/snapshots/diplomat__tests__method_taking_mutable_slice.snap":"eafa335a999e416a044d32106e096ef57b7f41fb2f74b03d4adce13e7179b03d","src/snapshots/diplomat__tests__method_taking_mutable_str.snap":"e4c65337861a78b3c9762545fcdbccc1169bab9183ff750fc467a5367dba9c56","src/snapshots/diplomat__tests__method_taking_slice.snap":"eb2d7d00381ddef71411c170ce27d2490acfe9322bc3de397fe1cedcedeeee7b","src/snapshots/diplomat__tests__method_taking_str.snap":"92aa38d8618f0d52d5bc967a8d67a87f4b9cdc4f8651c624a9cc7b73033dbaa4","src/snapshots/diplomat__tests__mod_with_enum.snap":"fc225e910aa1afe496eb8d4da4342894f7786c53e12725b2f70018cf5230dddc","src/snapshots/diplomat__tests__mod_with_rust_result.snap":"48e30564d2cf0477db7062c58842b264d0cfec1d635e7dbaf12c12a2e9f1ab31","src/snapshots/diplomat__tests__mod_with_writeable_result.snap":"6ddbc34dbf7d362366cddda70c87a2f25d7ba0821ccbab90b5a79748f1064593","src/snapshots/diplomat__tests__multilevel_borrows.snap":"708fb54c2c3b8498aac83c20af891e12212874b94691fd734fd57f500ce54666","src/snapshots/diplomat__tests__self_params.snap":"1f6652799973e4afa751afebd6306e71ea439640cc1cae9848c5757d060bf699","src/transparent_convert.rs":"dde901986a6709a21f359596e85bc4fd009bb645c79b698d5af8e2a603996ac4"},"package":null}
|
||||
{"files":{"Cargo.toml":"42a489a0e146bba3fe0d2c1e9abc24f8f24164404b88c687a53c575864ac7a7e","LICENSE-APACHE":"639c20c7f14fb122750d5ad1a6cfb116d9bf8d103e709ee40949e5a12a731666","LICENSE-MIT":"3337fe6e4a3830ad87c23cb9d6d750f9a1e5c45efc08de9c76c1a207fc6966c4","src/enum_convert.rs":"c0068cb8b563043030186cd9a0be6a4eac1a5f1761fe3646a99528e6d3dc5f54","src/lib.rs":"e05eb7285e68c64ee6936868cb3b39bfac041ee722bb4ecd6fb892fdf8bcff06","src/snapshots/diplomat__tests__cfgd_struct.snap":"2874497e83ba3f43541d90869bfa428973c5b23df7fec2826e187d530f1a620b","src/snapshots/diplomat__tests__cfged_method-2.snap":"b2ff2801b5f1e08bf660c63a5b8763cf99326e0b9d13cdcc9ae82532825727b2","src/snapshots/diplomat__tests__cfged_method.snap":"b478d2d14e01209b45032b092bf91a2068f08f704b2395bc3ebd2ada21141077","src/snapshots/diplomat__tests__method_taking_mutable_slice.snap":"eafa335a999e416a044d32106e096ef57b7f41fb2f74b03d4adce13e7179b03d","src/snapshots/diplomat__tests__method_taking_mutable_str.snap":"e4c65337861a78b3c9762545fcdbccc1169bab9183ff750fc467a5367dba9c56","src/snapshots/diplomat__tests__method_taking_slice.snap":"eb2d7d00381ddef71411c170ce27d2490acfe9322bc3de397fe1cedcedeeee7b","src/snapshots/diplomat__tests__method_taking_str.snap":"92aa38d8618f0d52d5bc967a8d67a87f4b9cdc4f8651c624a9cc7b73033dbaa4","src/snapshots/diplomat__tests__mod_with_enum.snap":"fc225e910aa1afe496eb8d4da4342894f7786c53e12725b2f70018cf5230dddc","src/snapshots/diplomat__tests__mod_with_rust_result.snap":"48e30564d2cf0477db7062c58842b264d0cfec1d635e7dbaf12c12a2e9f1ab31","src/snapshots/diplomat__tests__mod_with_writeable_result.snap":"6ddbc34dbf7d362366cddda70c87a2f25d7ba0821ccbab90b5a79748f1064593","src/snapshots/diplomat__tests__multilevel_borrows.snap":"708fb54c2c3b8498aac83c20af891e12212874b94691fd734fd57f500ce54666","src/snapshots/diplomat__tests__self_params.snap":"1f6652799973e4afa751afebd6306e71ea439640cc1cae9848c5757d060bf699","src/transparent_convert.rs":"dde901986a6709a21f359596e85bc4fd009bb645c79b698d5af8e2a603996ac4"},"package":"a31672b3ebc3c7866c3c98726f7a9a5ac8f13962e77d3c8225f6be49a7b8c5f2"}
|
25
third_party/rust/diplomat/Cargo.toml
vendored
25
third_party/rust/diplomat/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "diplomat"
|
||||
version = "0.5.2"
|
||||
version = "0.7.0"
|
||||
authors = [
|
||||
"Shadaj Laddad <shadaj@users.noreply.github.com>",
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
@ -25,20 +25,21 @@ keywords = [
|
||||
"codegen",
|
||||
]
|
||||
categories = ["development-tools"]
|
||||
license = "MIT/Apache-2.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-diplomat/diplomat"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0.27"
|
||||
quote = "1.0"
|
||||
|
||||
[dependencies.diplomat_core]
|
||||
version = "0.5.2"
|
||||
path = "../core"
|
||||
version = "0.7.0"
|
||||
|
||||
[dependencies.proc-macro2]
|
||||
version = "1.0.27"
|
||||
|
||||
[dependencies.quote]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.syn]
|
||||
version = "2.0"
|
||||
@ -47,6 +48,8 @@ features = [
|
||||
"extra-traits",
|
||||
]
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.7.1"
|
||||
tempfile = "3.2.0"
|
||||
[dev-dependencies.insta]
|
||||
version = "1.7.1"
|
||||
|
||||
[dev-dependencies.tempfile]
|
||||
version = "3.2.0"
|
||||
|
21
third_party/rust/diplomat/src/lib.rs
vendored
21
third_party/rust/diplomat/src/lib.rs
vendored
@ -7,11 +7,10 @@ use diplomat_core::ast;
|
||||
mod enum_convert;
|
||||
mod transparent_convert;
|
||||
|
||||
fn cfgs_to_stream(attrs: &[String]) -> proc_macro2::TokenStream {
|
||||
attrs.iter().fold(quote!(), |prev, attr| {
|
||||
let attr = attr.parse::<proc_macro2::TokenStream>().unwrap();
|
||||
quote!(#prev #attr)
|
||||
})
|
||||
fn cfgs_to_stream(attrs: &[Attribute]) -> proc_macro2::TokenStream {
|
||||
attrs
|
||||
.iter()
|
||||
.fold(quote!(), |prev, attr| quote!(#prev #attr))
|
||||
}
|
||||
|
||||
fn gen_params_at_boundary(param: &ast::Param, expanded_params: &mut Vec<FnArg>) {
|
||||
@ -197,7 +196,7 @@ fn gen_custom_type_method(strct: &ast::CustomType, m: &ast::Method) -> Item {
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let cfg = cfgs_to_stream(&m.cfg_attrs);
|
||||
let cfg = cfgs_to_stream(&m.attrs.cfg);
|
||||
|
||||
if writeable_flushes.is_empty() {
|
||||
Item::Fn(syn::parse_quote! {
|
||||
@ -241,7 +240,7 @@ impl AttributeInfo {
|
||||
if seg == "opaque" {
|
||||
opaque = true;
|
||||
return false;
|
||||
} else if seg == "rust_link" || seg == "out" {
|
||||
} else if seg == "rust_link" || seg == "out" || seg == "attr" {
|
||||
// diplomat-tool reads these, not diplomat::bridge.
|
||||
// throw them away so rustc doesn't complain about unknown attributes
|
||||
return false;
|
||||
@ -291,6 +290,12 @@ fn gen_bridge(input: ItemMod) -> ItemMod {
|
||||
if info.opaque {
|
||||
panic!("#[diplomat::opaque] not allowed on enums")
|
||||
}
|
||||
for v in &mut e.variants {
|
||||
let info = AttributeInfo::extract(&mut v.attrs);
|
||||
if info.opaque {
|
||||
panic!("#[diplomat::opaque] not allowed on enum variants");
|
||||
}
|
||||
}
|
||||
*e = syn::parse_quote! {
|
||||
#[repr(C)]
|
||||
#e
|
||||
@ -331,7 +336,7 @@ fn gen_bridge(input: ItemMod) -> ItemMod {
|
||||
(quote! {}, quote! {})
|
||||
};
|
||||
|
||||
let cfg = cfgs_to_stream(custom_type.cfg_attrs());
|
||||
let cfg = cfgs_to_stream(&custom_type.attrs().cfg);
|
||||
|
||||
// for now, body is empty since all we need to do is drop the box
|
||||
// TODO(#13): change to take a `*mut` and handle DST boxes appropriately
|
||||
|
@ -13,8 +13,8 @@ mod ffi {
|
||||
}
|
||||
}
|
||||
#[no_mangle]
|
||||
#[cfg(feature = "bar")]
|
||||
#[cfg(feature = "foo")]
|
||||
#[cfg(feature = "bar")]
|
||||
extern "C" fn Foo_bar(s: u8) {
|
||||
Foo::bar(s)
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
27
third_party/rust/diplomat_core/Cargo.toml
vendored
27
third_party/rust/diplomat_core/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "diplomat_core"
|
||||
version = "0.5.2"
|
||||
version = "0.7.0"
|
||||
authors = [
|
||||
"Shadaj Laddad <shadaj@users.noreply.github.com>",
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
@ -25,8 +25,9 @@ keywords = [
|
||||
"codegen",
|
||||
]
|
||||
categories = ["development-tools"]
|
||||
license = "MIT/Apache-2.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-diplomat/diplomat"
|
||||
resolver = "1"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@ -34,20 +35,26 @@ all-features = true
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "1.4.0"
|
||||
proc-macro2 = "1.0.27"
|
||||
quote = "1.0"
|
||||
smallvec = "1.9.0"
|
||||
|
||||
[dependencies.displaydoc]
|
||||
version = "0.2"
|
||||
optional = true
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.proc-macro2]
|
||||
version = "1.0.27"
|
||||
|
||||
[dependencies.quote]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
features = ["derive"]
|
||||
|
||||
[dependencies.smallvec]
|
||||
version = "1.9.0"
|
||||
|
||||
[dependencies.strck_ident]
|
||||
version = "0.1"
|
||||
features = ["rust"]
|
||||
@ -59,8 +66,8 @@ features = [
|
||||
"extra-traits",
|
||||
]
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.7.1"
|
||||
[dev-dependencies.insta]
|
||||
version = "1.7.1"
|
||||
|
||||
[features]
|
||||
hir = []
|
||||
|
209
third_party/rust/diplomat_core/src/ast/attrs.rs
vendored
209
third_party/rust/diplomat_core/src/ast/attrs.rs
vendored
@ -1,10 +1,207 @@
|
||||
//! This module contains utilities for dealing with Rust attributes
|
||||
|
||||
use syn::Attribute;
|
||||
use serde::ser::{SerializeStruct, Serializer};
|
||||
use serde::Serialize;
|
||||
use syn::parse::{Error as ParseError, Parse, ParseStream};
|
||||
use syn::{Attribute, Ident, LitStr, Meta, Token};
|
||||
|
||||
pub(crate) fn extract_cfg_attrs(attrs: &[Attribute]) -> impl Iterator<Item = String> + '_ {
|
||||
attrs
|
||||
.iter()
|
||||
.filter(|&a| a.path().is_ident("cfg"))
|
||||
.map(|a| quote::quote!(#a).to_string())
|
||||
/// The list of attributes on a type
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, Default)]
|
||||
#[non_exhaustive]
|
||||
pub struct Attrs {
|
||||
pub cfg: Vec<Attribute>,
|
||||
pub attrs: Vec<DiplomatBackendAttr>,
|
||||
}
|
||||
|
||||
impl Attrs {
|
||||
fn add_attr(&mut self, attr: Attr) {
|
||||
match attr {
|
||||
Attr::Cfg(attr) => self.cfg.push(attr),
|
||||
Attr::DiplomatBackendAttr(attr) => self.attrs.push(attr),
|
||||
}
|
||||
}
|
||||
|
||||
/// Merge attributes that should be inherited from the parent
|
||||
pub(crate) fn merge_parent_attrs(&mut self, other: &Attrs) {
|
||||
self.cfg.extend(other.cfg.iter().cloned())
|
||||
}
|
||||
pub(crate) fn add_attrs(&mut self, attrs: &[Attribute]) {
|
||||
for attr in syn_attr_to_ast_attr(attrs) {
|
||||
self.add_attr(attr)
|
||||
}
|
||||
}
|
||||
pub(crate) fn from_attrs(attrs: &[Attribute]) -> Self {
|
||||
let mut this = Self::default();
|
||||
this.add_attrs(attrs);
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&[Attribute]> for Attrs {
|
||||
fn from(other: &[Attribute]) -> Self {
|
||||
Self::from_attrs(other)
|
||||
}
|
||||
}
|
||||
|
||||
enum Attr {
|
||||
Cfg(Attribute),
|
||||
DiplomatBackendAttr(DiplomatBackendAttr),
|
||||
// More goes here
|
||||
}
|
||||
|
||||
fn syn_attr_to_ast_attr(attrs: &[Attribute]) -> impl Iterator<Item = Attr> + '_ {
|
||||
let cfg_path: syn::Path = syn::parse_str("cfg").unwrap();
|
||||
let dattr_path: syn::Path = syn::parse_str("diplomat::attr").unwrap();
|
||||
attrs.iter().filter_map(move |a| {
|
||||
if a.path() == &cfg_path {
|
||||
Some(Attr::Cfg(a.clone()))
|
||||
} else if a.path() == &dattr_path {
|
||||
Some(Attr::DiplomatBackendAttr(
|
||||
a.parse_args()
|
||||
.expect("Failed to parse malformed diplomat::attr"),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
impl Serialize for Attrs {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
// 1 is the number of fields in the struct.
|
||||
let mut state = serializer.serialize_struct("Attrs", 1)?;
|
||||
let cfg: Vec<_> = self
|
||||
.cfg
|
||||
.iter()
|
||||
.map(|a| quote::quote!(#a).to_string())
|
||||
.collect();
|
||||
state.serialize_field("cfg", &cfg)?;
|
||||
state.end()
|
||||
}
|
||||
}
|
||||
|
||||
/// A `#[diplomat::attr(...)]` attribute
|
||||
///
|
||||
/// Its contents must start with single element that is a CFG-expression
|
||||
/// (so it may contain `foo = bar`, `foo = "bar"`, `ident`, `*` atoms,
|
||||
/// and `all()`, `not()`, and `any()` combiners), and then be followed by one
|
||||
/// or more backend-specific attributes, which can be any valid meta-item
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, Serialize)]
|
||||
#[non_exhaustive]
|
||||
pub struct DiplomatBackendAttr {
|
||||
pub cfg: DiplomatBackendAttrCfg,
|
||||
#[serde(serialize_with = "serialize_meta")]
|
||||
pub meta: Meta,
|
||||
}
|
||||
|
||||
fn serialize_meta<S>(m: &Meta, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
quote::quote!(#m).to_string().serialize(s)
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, Serialize)]
|
||||
#[non_exhaustive]
|
||||
pub enum DiplomatBackendAttrCfg {
|
||||
Not(Box<DiplomatBackendAttrCfg>),
|
||||
Any(Vec<DiplomatBackendAttrCfg>),
|
||||
All(Vec<DiplomatBackendAttrCfg>),
|
||||
Star,
|
||||
BackendName(String),
|
||||
NameValue(String, String),
|
||||
}
|
||||
|
||||
impl Parse for DiplomatBackendAttrCfg {
|
||||
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
|
||||
let lookahead = input.lookahead1();
|
||||
if lookahead.peek(Ident) {
|
||||
let name: Ident = input.parse()?;
|
||||
if name == "not" {
|
||||
let content;
|
||||
let _paren = syn::parenthesized!(content in input);
|
||||
Ok(DiplomatBackendAttrCfg::Not(Box::new(content.parse()?)))
|
||||
} else if name == "any" || name == "all" {
|
||||
let content;
|
||||
let _paren = syn::parenthesized!(content in input);
|
||||
let list = content.parse_terminated(Self::parse, Token![,])?;
|
||||
let vec = list.into_iter().collect();
|
||||
if name == "any" {
|
||||
Ok(DiplomatBackendAttrCfg::Any(vec))
|
||||
} else {
|
||||
Ok(DiplomatBackendAttrCfg::All(vec))
|
||||
}
|
||||
} else if input.peek(Token![=]) {
|
||||
let _t: Token![=] = input.parse()?;
|
||||
if input.peek(Ident) {
|
||||
let value: Ident = input.parse()?;
|
||||
Ok(DiplomatBackendAttrCfg::NameValue(
|
||||
name.to_string(),
|
||||
value.to_string(),
|
||||
))
|
||||
} else {
|
||||
let value: LitStr = input.parse()?;
|
||||
Ok(DiplomatBackendAttrCfg::NameValue(
|
||||
name.to_string(),
|
||||
value.value(),
|
||||
))
|
||||
}
|
||||
} else {
|
||||
Ok(DiplomatBackendAttrCfg::BackendName(name.to_string()))
|
||||
}
|
||||
} else if lookahead.peek(Token![*]) {
|
||||
let _t: Token![*] = input.parse()?;
|
||||
Ok(DiplomatBackendAttrCfg::Star)
|
||||
} else {
|
||||
Err(ParseError::new(
|
||||
input.span(),
|
||||
"CFG portion of #[diplomat::attr] fails to parse",
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Meant to be used with Attribute::parse_args()
|
||||
impl Parse for DiplomatBackendAttr {
|
||||
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
|
||||
let cfg = input.parse()?;
|
||||
let _comma: Token![,] = input.parse()?;
|
||||
let meta = input.parse()?;
|
||||
Ok(Self { cfg, meta })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use insta;
|
||||
|
||||
use syn;
|
||||
|
||||
use super::{DiplomatBackendAttr, DiplomatBackendAttrCfg};
|
||||
|
||||
#[test]
|
||||
fn test_cfgs() {
|
||||
let attr_cfg: DiplomatBackendAttrCfg = syn::parse_quote!(*);
|
||||
insta::assert_yaml_snapshot!(attr_cfg);
|
||||
let attr_cfg: DiplomatBackendAttrCfg = syn::parse_quote!(cpp);
|
||||
insta::assert_yaml_snapshot!(attr_cfg);
|
||||
let attr_cfg: DiplomatBackendAttrCfg = syn::parse_quote!(has = overloading);
|
||||
insta::assert_yaml_snapshot!(attr_cfg);
|
||||
let attr_cfg: DiplomatBackendAttrCfg = syn::parse_quote!(has = "overloading");
|
||||
insta::assert_yaml_snapshot!(attr_cfg);
|
||||
let attr_cfg: DiplomatBackendAttrCfg =
|
||||
syn::parse_quote!(any(all(*, cpp, has="overloading"), not(js)));
|
||||
insta::assert_yaml_snapshot!(attr_cfg);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_attr() {
|
||||
let attr: syn::Attribute =
|
||||
syn::parse_quote!(#[diplomat::attr(any(cpp, has = "overloading"), namespacing)]);
|
||||
let attr: DiplomatBackendAttr = attr.parse_args().unwrap();
|
||||
insta::assert_yaml_snapshot!(attr);
|
||||
}
|
||||
}
|
||||
|
14
third_party/rust/diplomat_core/src/ast/docs.rs
vendored
14
third_party/rust/diplomat_core/src/ast/docs.rs
vendored
@ -14,6 +14,7 @@ pub struct Docs(String, Vec<RustLink>);
|
||||
/// Note that this only controls markdown generated by this code. Existing markdown
|
||||
/// in the Rust documentation will not be sanitized in any way.
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum MarkdownStyle {
|
||||
/// Regular markdown with no specific extensions, compatible with most common flavors
|
||||
Normal,
|
||||
@ -73,9 +74,12 @@ impl Docs {
|
||||
if rust_link.display == RustLinkDisplay::Compact {
|
||||
has_compact = true;
|
||||
} else if rust_link.display == RustLinkDisplay::Normal {
|
||||
if !lines.is_empty() {
|
||||
write!(lines, "\n\n").unwrap();
|
||||
}
|
||||
write!(
|
||||
lines,
|
||||
"\n\nSee the [Rust documentation for {backtick}{name}{backtick}]({link}) for more information.",
|
||||
"See the [Rust documentation for {backtick}{name}{backtick}]({link}) for more information.",
|
||||
name = rust_link.path.elements.last().unwrap(),
|
||||
link = docs_url_gen.gen_for_rust_link(rust_link)
|
||||
)
|
||||
@ -83,7 +87,10 @@ impl Docs {
|
||||
}
|
||||
}
|
||||
if has_compact {
|
||||
write!(lines, "\n\n Additional information: ").unwrap();
|
||||
if !lines.is_empty() {
|
||||
write!(lines, "\n\n").unwrap();
|
||||
}
|
||||
write!(lines, "Additional information: ").unwrap();
|
||||
for (i, rust_link) in self
|
||||
.1
|
||||
.iter()
|
||||
@ -111,6 +118,7 @@ impl Docs {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub enum RustLinkDisplay {
|
||||
/// A nice expanded representation that includes the type name
|
||||
///
|
||||
@ -125,6 +133,7 @@ pub enum RustLinkDisplay {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug, PartialOrd, Ord)]
|
||||
#[non_exhaustive]
|
||||
pub struct RustLink {
|
||||
pub path: Path,
|
||||
pub typ: DocType,
|
||||
@ -189,6 +198,7 @@ impl fmt::Display for RustLink {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug, PartialOrd, Ord)]
|
||||
#[non_exhaustive]
|
||||
pub enum DocType {
|
||||
Struct,
|
||||
StructField,
|
||||
|
17
third_party/rust/diplomat_core/src/ast/enums.rs
vendored
17
third_party/rust/diplomat_core/src/ast/enums.rs
vendored
@ -1,18 +1,19 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
|
||||
use super::docs::Docs;
|
||||
use super::{attrs, Ident, Method};
|
||||
use super::{Attrs, Ident, Method};
|
||||
use quote::ToTokens;
|
||||
|
||||
/// A fieldless enum declaration in an FFI module.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[derive(Clone, Serialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub struct Enum {
|
||||
pub name: Ident,
|
||||
pub docs: Docs,
|
||||
/// A list of variants of the enum. (name, discriminant, docs)
|
||||
pub variants: Vec<(Ident, isize, Docs)>,
|
||||
/// A list of variants of the enum. (name, discriminant, docs, attrs)
|
||||
pub variants: Vec<(Ident, isize, Docs, Attrs)>,
|
||||
pub methods: Vec<Method>,
|
||||
pub cfg_attrs: Vec<String>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
impl From<&syn::ItemEnum> for Enum {
|
||||
@ -27,7 +28,6 @@ impl From<&syn::ItemEnum> for Enum {
|
||||
panic!("Enums cannot have generic parameters");
|
||||
}
|
||||
|
||||
let cfg_attrs = attrs::extract_cfg_attrs(&enm.attrs).collect();
|
||||
Enum {
|
||||
name: (&enm.ident).into(),
|
||||
docs: Docs::from_attrs(&enm.attrs),
|
||||
@ -56,11 +56,12 @@ impl From<&syn::ItemEnum> for Enum {
|
||||
(&v.ident).into(),
|
||||
new_discriminant,
|
||||
Docs::from_attrs(&v.attrs),
|
||||
(&*v.attrs).into(),
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
methods: vec![],
|
||||
cfg_attrs,
|
||||
attrs: (&*enm.attrs).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,6 +395,7 @@ pub(crate) struct LifetimeNode {
|
||||
|
||||
/// A lifetime, analogous to [`syn::Lifetime`].
|
||||
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub enum Lifetime {
|
||||
/// The `'static` lifetime.
|
||||
Static,
|
||||
|
@ -1,15 +1,17 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use super::attrs;
|
||||
use super::docs::Docs;
|
||||
use super::{Ident, Lifetime, LifetimeEnv, Mutability, Path, PathType, TypeName, ValidityError};
|
||||
use super::{
|
||||
Attrs, Ident, Lifetime, LifetimeEnv, Mutability, Path, PathType, TypeName, ValidityError,
|
||||
};
|
||||
use crate::Env;
|
||||
|
||||
/// A method declared in the `impl` associated with an FFI struct.
|
||||
/// Includes both static and non-static methods, which can be distinguished
|
||||
/// by inspecting [`Method::self_param`].
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Method {
|
||||
/// The name of the method as initially declared.
|
||||
pub name: Ident,
|
||||
@ -36,7 +38,7 @@ pub struct Method {
|
||||
///
|
||||
/// These are strings instead of `syn::Attribute` or `proc_macro2::TokenStream`
|
||||
/// because those types are not `PartialEq`, `Hash`, `Serialize`, etc.
|
||||
pub cfg_attrs: Vec<String>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
impl Method {
|
||||
@ -45,7 +47,7 @@ impl Method {
|
||||
m: &syn::ImplItemFn,
|
||||
self_path_type: PathType,
|
||||
impl_generics: Option<&syn::Generics>,
|
||||
cfg_attrs: &[String],
|
||||
impl_attrs: &Attrs,
|
||||
) -> Method {
|
||||
let self_ident = self_path_type.path.elements.last().unwrap();
|
||||
let method_ident = &m.sig.ident;
|
||||
@ -89,8 +91,8 @@ impl Method {
|
||||
return_ty.as_ref(),
|
||||
);
|
||||
|
||||
let mut cfg_attrs = cfg_attrs.to_owned();
|
||||
cfg_attrs.extend(attrs::extract_cfg_attrs(&m.attrs));
|
||||
let mut attrs: Attrs = (&*m.attrs).into();
|
||||
attrs.merge_parent_attrs(impl_attrs);
|
||||
|
||||
Method {
|
||||
name: Ident::from(method_ident),
|
||||
@ -100,7 +102,7 @@ impl Method {
|
||||
params: all_params,
|
||||
return_type: return_ty,
|
||||
lifetime_env,
|
||||
cfg_attrs,
|
||||
attrs,
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +244,8 @@ impl Method {
|
||||
}
|
||||
|
||||
/// The `self` parameter taken by a [`Method`].
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct SelfParam {
|
||||
/// The lifetime and mutability of the `self` param, if it's a reference.
|
||||
pub reference: Option<(Lifetime, Mutability)>,
|
||||
@ -273,7 +276,8 @@ impl SelfParam {
|
||||
}
|
||||
|
||||
/// A parameter taken by a [`Method`], not including `self`.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Param {
|
||||
/// The name of the parameter in the original method declaration.
|
||||
pub name: Ident,
|
||||
@ -315,6 +319,7 @@ pub enum LifetimeKind {
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
/// Parameters in a method that might be borrowed in the return type.
|
||||
#[non_exhaustive]
|
||||
pub struct BorrowedParams<'a>(
|
||||
pub Option<&'a SelfParam>,
|
||||
pub Vec<(&'a Param, LifetimeKind)>,
|
||||
@ -326,9 +331,10 @@ impl BorrowedParams<'_> {
|
||||
/// param will be called if present.
|
||||
pub fn return_names<'a>(&'a self, self_name: &'a Ident) -> impl Iterator<Item = &'a Ident> {
|
||||
self.0.iter().map(move |_| self_name).chain(
|
||||
self.1.iter().filter_map(|&(param, ltk)| {
|
||||
(ltk == LifetimeKind::ReturnValue).then(|| ¶m.name)
|
||||
}),
|
||||
self.1
|
||||
.iter()
|
||||
.filter(|(_, ltk)| (*ltk == LifetimeKind::ReturnValue))
|
||||
.map(|(param, _)| ¶m.name),
|
||||
)
|
||||
}
|
||||
|
||||
@ -337,7 +343,8 @@ impl BorrowedParams<'_> {
|
||||
pub fn static_names(&self) -> impl Iterator<Item = &'_ Ident> {
|
||||
self.1
|
||||
.iter()
|
||||
.filter_map(|&(param, ltk)| (ltk == LifetimeKind::Static).then(|| ¶m.name))
|
||||
.filter(|(_, ltk)| (*ltk == LifetimeKind::Static))
|
||||
.map(|(param, _)| ¶m.name)
|
||||
}
|
||||
|
||||
/// Returns `true` if a provided param name is included in the borrowed params,
|
||||
@ -378,7 +385,7 @@ mod tests {
|
||||
|
||||
use crate::ast::Ident;
|
||||
|
||||
use super::{Method, Path, PathType};
|
||||
use super::{Attrs, Method, Path, PathType};
|
||||
|
||||
#[test]
|
||||
fn static_methods() {
|
||||
@ -392,7 +399,7 @@ mod tests {
|
||||
},
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
));
|
||||
|
||||
insta::assert_yaml_snapshot!(Method::from_syn(
|
||||
@ -408,7 +415,7 @@ mod tests {
|
||||
},
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
));
|
||||
}
|
||||
|
||||
@ -425,7 +432,7 @@ mod tests {
|
||||
},
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
));
|
||||
}
|
||||
|
||||
@ -439,7 +446,7 @@ mod tests {
|
||||
},
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
));
|
||||
|
||||
insta::assert_yaml_snapshot!(Method::from_syn(
|
||||
@ -451,7 +458,7 @@ mod tests {
|
||||
},
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
));
|
||||
}
|
||||
|
||||
@ -461,7 +468,7 @@ mod tests {
|
||||
&syn::parse_quote! { $($tokens)* },
|
||||
PathType::new(Path::empty().sub_path(Ident::from("MyStructContainingMethod"))),
|
||||
None,
|
||||
&[]
|
||||
&Attrs::default()
|
||||
);
|
||||
|
||||
let borrowed_params = method.borrowed_params();
|
||||
|
@ -2,7 +2,8 @@
|
||||
/// generates a simplified version of the Rust AST that captures special
|
||||
/// types such as opaque structs, [`Box`], and [`Result`] with utilities
|
||||
/// for handling such types.
|
||||
pub(crate) mod attrs;
|
||||
pub mod attrs;
|
||||
pub use attrs::Attrs;
|
||||
|
||||
mod methods;
|
||||
pub use methods::{BorrowedParams, Method, Param, SelfParam};
|
||||
|
@ -2,11 +2,11 @@ use std::collections::{BTreeMap, HashSet};
|
||||
use std::fmt::Write as _;
|
||||
|
||||
use quote::ToTokens;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
use syn::{ImplItem, Item, ItemMod, UseTree, Visibility};
|
||||
|
||||
use super::{
|
||||
attrs, CustomType, Enum, Ident, Method, ModSymbol, Mutability, OpaqueStruct, Path, PathType,
|
||||
Attrs, CustomType, Enum, Ident, Method, ModSymbol, Mutability, OpaqueStruct, Path, PathType,
|
||||
RustLink, Struct, ValidityError,
|
||||
};
|
||||
use crate::environment::*;
|
||||
@ -59,7 +59,8 @@ impl DiplomatStructAttribute {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Module {
|
||||
pub name: Ident,
|
||||
pub imports: Vec<(Path, Ident)>,
|
||||
@ -176,7 +177,7 @@ impl Module {
|
||||
syn::Type::Path(s) => PathType::from(s),
|
||||
_ => panic!("Self type not found"),
|
||||
};
|
||||
let cfg_attrs: Vec<_> = attrs::extract_cfg_attrs(&imp.attrs).collect();
|
||||
let attrs = Attrs::from(&*imp.attrs);
|
||||
|
||||
let mut new_methods = imp
|
||||
.items
|
||||
@ -186,7 +187,7 @@ impl Module {
|
||||
_ => None,
|
||||
})
|
||||
.filter(|m| matches!(m.vis, Visibility::Public(_)))
|
||||
.map(|m| Method::from_syn(m, self_path.clone(), Some(&imp.generics), &cfg_attrs))
|
||||
.map(|m| Method::from_syn(m, self_path.clone(), Some(&imp.generics), &attrs))
|
||||
.collect();
|
||||
|
||||
let self_ident = self_path.path.elements.last().unwrap();
|
||||
@ -242,7 +243,8 @@ fn extract_imports(base_path: &Path, use_tree: &UseTree, out: &mut Vec<(Path, Id
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[derive(Serialize, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct File {
|
||||
pub modules: BTreeMap<String, Module>,
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ use std::fmt;
|
||||
use super::Ident;
|
||||
|
||||
#[derive(Hash, Eq, PartialEq, Deserialize, Serialize, Clone, Debug, Ord, PartialOrd)]
|
||||
#[non_exhaustive]
|
||||
pub struct Path {
|
||||
pub elements: Vec<Ident>,
|
||||
}
|
||||
|
12
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__attr.snap
vendored
Normal file
12
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__attr.snap
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr
|
||||
---
|
||||
cfg:
|
||||
Any:
|
||||
- BackendName: cpp
|
||||
- NameValue:
|
||||
- has
|
||||
- overloading
|
||||
meta: namespacing
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr_cfg
|
||||
---
|
||||
BackendName: cpp
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr_cfg
|
||||
---
|
||||
NameValue:
|
||||
- has
|
||||
- overloading
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr_cfg
|
||||
---
|
||||
NameValue:
|
||||
- has
|
||||
- overloading
|
||||
|
14
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__cfgs-5.snap
vendored
Normal file
14
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__cfgs-5.snap
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr_cfg
|
||||
---
|
||||
Any:
|
||||
- All:
|
||||
- Star
|
||||
- BackendName: cpp
|
||||
- NameValue:
|
||||
- has
|
||||
- overloading
|
||||
- Not:
|
||||
BackendName: js
|
||||
|
6
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__cfgs.snap
vendored
Normal file
6
third_party/rust/diplomat_core/src/ast/snapshots/diplomat_core__ast__attrs__tests__cfgs.snap
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/attrs.rs
|
||||
expression: attr_cfg
|
||||
---
|
||||
Star
|
||||
|
@ -16,18 +16,23 @@ variants:
|
||||
- -1
|
||||
- - ""
|
||||
- []
|
||||
- cfg: []
|
||||
- - Def
|
||||
- 0
|
||||
- - ""
|
||||
- []
|
||||
- cfg: []
|
||||
- - Ghi
|
||||
- 1
|
||||
- - ""
|
||||
- []
|
||||
- cfg: []
|
||||
- - Jkl
|
||||
- 2
|
||||
- - ""
|
||||
- []
|
||||
- cfg: []
|
||||
methods: []
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -16,10 +16,13 @@ variants:
|
||||
- 0
|
||||
- - ""
|
||||
- []
|
||||
- cfg: []
|
||||
- - Def
|
||||
- 1
|
||||
- - Some more docs.
|
||||
- []
|
||||
- cfg: []
|
||||
methods: []
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/methods.rs
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)]\n #[cfg(any(feature = \"foo\", not(feature = \"bar\")))] fn\n foo(x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &[])"
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)]\n #[cfg(any(feature = \"foo\", not(feature = \"bar\")))] fn\n foo(x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &Attrs::default())"
|
||||
---
|
||||
name: foo
|
||||
docs:
|
||||
@ -27,6 +27,7 @@ params:
|
||||
lifetimes: []
|
||||
return_type: ~
|
||||
lifetime_env: {}
|
||||
cfg_attrs:
|
||||
- "# [cfg (any (feature = \"foo\" , not (feature = \"bar\")))]"
|
||||
attrs:
|
||||
cfg:
|
||||
- "# [cfg (any (feature = \"foo\" , not (feature = \"bar\")))]"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/methods.rs
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)] fn\n foo(& mut self, x : u64, y : MyCustomStruct) -> u64 { x }\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &[])"
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)] fn\n foo(& mut self, x : u64, y : MyCustomStruct) -> u64 { x }\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &Attrs::default())"
|
||||
---
|
||||
name: foo
|
||||
docs:
|
||||
@ -36,5 +36,6 @@ params:
|
||||
return_type:
|
||||
Primitive: u64
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/methods.rs
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n fn foo(& self, x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &[])"
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n fn foo(& self, x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &Attrs::default())"
|
||||
---
|
||||
name: foo
|
||||
docs:
|
||||
@ -29,5 +29,6 @@ params:
|
||||
lifetimes: []
|
||||
return_type: ~
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/methods.rs
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n /// Some more docs.\n ///\n /// Even more docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInEnum)] fn\n foo(x : u64, y : MyCustomStruct) -> u64 { x }\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &[])"
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n /// Some more docs.\n ///\n /// Even more docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInEnum)] fn\n foo(x : u64, y : MyCustomStruct) -> u64 { x }\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &Attrs::default())"
|
||||
---
|
||||
name: foo
|
||||
docs:
|
||||
@ -28,5 +28,6 @@ params:
|
||||
return_type:
|
||||
Primitive: u64
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: core/src/ast/methods.rs
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)] fn\n foo(x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &[])"
|
||||
expression: "Method::from_syn(&syn::parse_quote! {\n /// Some docs.\n #[diplomat :: rust_link(foo :: Bar :: batz, FnInStruct)] fn\n foo(x : u64, y : MyCustomStruct) {}\n },\n PathType::new(Path::empty().sub_path(Ident::from(\"MyStructContainingMethod\"))),\n None, &Attrs::default())"
|
||||
---
|
||||
name: foo
|
||||
docs:
|
||||
@ -27,5 +27,6 @@ params:
|
||||
lifetimes: []
|
||||
return_type: ~
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -17,7 +17,8 @@ modules:
|
||||
fields: []
|
||||
methods: []
|
||||
output_only: false
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
sub_modules: []
|
||||
other:
|
||||
name: other
|
||||
|
@ -23,8 +23,10 @@ declared_types:
|
||||
params: []
|
||||
return_type: ~
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
output_only: false
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
sub_modules: []
|
||||
|
||||
|
@ -44,7 +44,8 @@ declared_types:
|
||||
- NonOpaqueStruct
|
||||
lifetimes: []
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
- name: set_a
|
||||
docs:
|
||||
- ""
|
||||
@ -65,9 +66,11 @@ declared_types:
|
||||
Primitive: i32
|
||||
return_type: ~
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
output_only: false
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
OpaqueStruct:
|
||||
Opaque:
|
||||
name: OpaqueStruct
|
||||
@ -91,7 +94,8 @@ declared_types:
|
||||
- OpaqueStruct
|
||||
lifetimes: []
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
- name: get_string
|
||||
docs:
|
||||
- ""
|
||||
@ -114,8 +118,10 @@ declared_types:
|
||||
- String
|
||||
lifetimes: []
|
||||
lifetime_env: {}
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
mutability: Immutable
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
sub_modules: []
|
||||
|
||||
|
@ -28,5 +28,6 @@ fields:
|
||||
- []
|
||||
methods: []
|
||||
output_only: true
|
||||
cfg_attrs: []
|
||||
attrs:
|
||||
cfg: []
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Serialize;
|
||||
|
||||
use super::docs::Docs;
|
||||
use super::{attrs, Ident, LifetimeEnv, Method, Mutability, PathType, TypeName};
|
||||
use super::{Attrs, Ident, LifetimeEnv, Method, Mutability, PathType, TypeName};
|
||||
|
||||
/// A struct declaration in an FFI module that is not opaque.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Struct {
|
||||
pub name: Ident,
|
||||
pub docs: Docs,
|
||||
@ -12,7 +13,7 @@ pub struct Struct {
|
||||
pub fields: Vec<(Ident, TypeName, Docs)>,
|
||||
pub methods: Vec<Method>,
|
||||
pub output_only: bool,
|
||||
pub cfg_attrs: Vec<String>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
@ -37,7 +38,6 @@ impl Struct {
|
||||
.collect();
|
||||
|
||||
let lifetimes = LifetimeEnv::from_struct_item(strct, &fields[..]);
|
||||
let cfg_attrs = attrs::extract_cfg_attrs(&strct.attrs).collect();
|
||||
|
||||
Struct {
|
||||
name: (&strct.ident).into(),
|
||||
@ -46,7 +46,7 @@ impl Struct {
|
||||
fields,
|
||||
methods: vec![],
|
||||
output_only,
|
||||
cfg_attrs,
|
||||
attrs: (&*strct.attrs).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,27 +54,27 @@ impl Struct {
|
||||
/// A struct annotated with [`diplomat::opaque`] whose fields are not visible.
|
||||
/// Opaque structs cannot be passed by-value across the FFI boundary, so they
|
||||
/// must be boxed or passed as references.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[derive(Clone, Serialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub struct OpaqueStruct {
|
||||
pub name: Ident,
|
||||
pub docs: Docs,
|
||||
pub lifetimes: LifetimeEnv,
|
||||
pub methods: Vec<Method>,
|
||||
pub mutability: Mutability,
|
||||
pub cfg_attrs: Vec<String>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
impl OpaqueStruct {
|
||||
/// Extract a [`OpaqueStruct`] metadata value from an AST node.
|
||||
pub fn new(strct: &syn::ItemStruct, mutability: Mutability) -> Self {
|
||||
let cfg_attrs = attrs::extract_cfg_attrs(&strct.attrs).collect();
|
||||
OpaqueStruct {
|
||||
name: Ident::from(&strct.ident),
|
||||
docs: Docs::from_attrs(&strct.attrs),
|
||||
lifetimes: LifetimeEnv::from_struct_item(strct, &[]),
|
||||
methods: vec![],
|
||||
mutability,
|
||||
cfg_attrs,
|
||||
attrs: (&*strct.attrs).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
third_party/rust/diplomat_core/src/ast/types.rs
vendored
21
third_party/rust/diplomat_core/src/ast/types.rs
vendored
@ -9,13 +9,14 @@ use std::fmt;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use super::{
|
||||
Docs, Enum, Ident, Lifetime, LifetimeEnv, LifetimeTransitivity, Method, NamedLifetime,
|
||||
Attrs, Docs, Enum, Ident, Lifetime, LifetimeEnv, LifetimeTransitivity, Method, NamedLifetime,
|
||||
OpaqueStruct, Path, RustLink, Struct, ValidityError,
|
||||
};
|
||||
use crate::Env;
|
||||
|
||||
/// A type declared inside a Diplomat-annotated module.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[derive(Clone, Serialize, Debug, Hash, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum CustomType {
|
||||
/// A non-opaque struct whose fields will be visible across the FFI boundary.
|
||||
Struct(Struct),
|
||||
@ -44,11 +45,11 @@ impl CustomType {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cfg_attrs(&self) -> &[String] {
|
||||
pub fn attrs(&self) -> &Attrs {
|
||||
match self {
|
||||
CustomType::Struct(strct) => &strct.cfg_attrs,
|
||||
CustomType::Opaque(strct) => &strct.cfg_attrs,
|
||||
CustomType::Enum(enm) => &enm.cfg_attrs,
|
||||
CustomType::Struct(strct) => &strct.attrs,
|
||||
CustomType::Opaque(strct) => &strct.attrs,
|
||||
CustomType::Enum(enm) => &enm.attrs,
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +127,8 @@ impl CustomType {
|
||||
|
||||
/// A symbol declared in a module, which can either be a pointer to another path,
|
||||
/// or a custom type defined directly inside that module
|
||||
#[derive(Clone, Serialize, Deserialize, Debug)]
|
||||
#[derive(Clone, Serialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum ModSymbol {
|
||||
/// A symbol that is a pointer to another path.
|
||||
Alias(Path),
|
||||
@ -138,6 +140,7 @@ pub enum ModSymbol {
|
||||
|
||||
/// A named type that is just a path, e.g. `std::borrow::Cow<'a, T>`.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct PathType {
|
||||
pub path: Path,
|
||||
pub lifetimes: Vec<Lifetime>,
|
||||
@ -299,6 +302,7 @@ impl From<Path> for PathType {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only two kinds of mutability we care about
|
||||
pub enum Mutability {
|
||||
Mutable,
|
||||
Immutable,
|
||||
@ -361,6 +365,7 @@ impl Mutability {
|
||||
/// Unlike [`CustomType`], which represents a type declaration, [`TypeName`]s can compose
|
||||
/// types through references and boxing, and can also capture unresolved paths.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum TypeName {
|
||||
/// A built-in Rust scalar primitive.
|
||||
Primitive(PrimitiveType),
|
||||
@ -882,6 +887,7 @@ impl TypeName {
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum LifetimeOrigin {
|
||||
Named,
|
||||
Reference,
|
||||
@ -973,6 +979,7 @@ impl fmt::Display for PathType {
|
||||
/// A built-in Rust primitive scalar type.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these (scalar types)
|
||||
pub enum PrimitiveType {
|
||||
i8,
|
||||
u8,
|
||||
|
@ -2,6 +2,7 @@ use super::{Ident, Path, TypeName};
|
||||
|
||||
#[cfg_attr(feature = "displaydoc", derive(displaydoc::Display))]
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum ValidityError {
|
||||
/// An oqaue type crosses the FFI boundary as a value.
|
||||
#[cfg_attr(
|
||||
|
194
third_party/rust/diplomat_core/src/hir/attrs.rs
vendored
Normal file
194
third_party/rust/diplomat_core/src/hir/attrs.rs
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
//! #[diplomat::attr] and other attributes
|
||||
|
||||
use crate::ast;
|
||||
use crate::ast::attrs::DiplomatBackendAttrCfg;
|
||||
use crate::hir::LoweringError;
|
||||
|
||||
use quote::ToTokens;
|
||||
use syn::{LitStr, Meta};
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct Attrs {
|
||||
pub disable: bool,
|
||||
pub rename: Option<String>,
|
||||
// more to be added: rename, namespace, etc
|
||||
}
|
||||
|
||||
/// Where the attribute was found. Some attributes are only allowed in some contexts
|
||||
/// (e.g. namespaces cannot be specified on methods)
|
||||
#[non_exhaustive] // might add module attrs in the future
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum AttributeContext {
|
||||
Struct { out: bool },
|
||||
Enum,
|
||||
EnumVariant,
|
||||
Opaque,
|
||||
Method,
|
||||
}
|
||||
|
||||
impl Attrs {
|
||||
pub fn from_ast(
|
||||
ast: &ast::Attrs,
|
||||
validator: &(impl AttributeValidator + ?Sized),
|
||||
context: AttributeContext,
|
||||
errors: &mut Vec<LoweringError>,
|
||||
) -> Self {
|
||||
let mut this = Attrs::default();
|
||||
let support = validator.attrs_supported();
|
||||
for attr in &ast.attrs {
|
||||
if validator.satisfies_cfg(&attr.cfg) {
|
||||
match &attr.meta {
|
||||
Meta::Path(p) => {
|
||||
if p.is_ident("disable") {
|
||||
if this.disable {
|
||||
errors.push(LoweringError::Other(
|
||||
"Duplicate `disable` attribute".into(),
|
||||
));
|
||||
} else if !support.disabling {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"`disable` not supported in backend {}",
|
||||
validator.primary_name()
|
||||
)))
|
||||
} else if context == AttributeContext::EnumVariant {
|
||||
errors.push(LoweringError::Other(
|
||||
"`disable` cannot be used on enum variants".into(),
|
||||
))
|
||||
} else {
|
||||
this.disable = true;
|
||||
}
|
||||
} else {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"Unknown diplomat attribute {p:?}: expected one of: `disable, rename`"
|
||||
)));
|
||||
}
|
||||
}
|
||||
Meta::NameValue(nv) => {
|
||||
let p = &nv.path;
|
||||
if p.is_ident("rename") {
|
||||
if this.rename.is_some() {
|
||||
errors.push(LoweringError::Other(
|
||||
"Duplicate `rename` attribute".into(),
|
||||
));
|
||||
} else if !support.renaming {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"`rename` not supported in backend {}",
|
||||
validator.primary_name()
|
||||
)))
|
||||
} else {
|
||||
let v = nv.value.to_token_stream();
|
||||
let l = syn::parse2::<LitStr>(v);
|
||||
if let Ok(ref l) = l {
|
||||
this.rename = Some(l.value())
|
||||
} else {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"Found diplomat attribute {p:?}: expected string as `rename` argument"
|
||||
)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"Unknown diplomat attribute {p:?}: expected one of: `disable, rename`"
|
||||
)));
|
||||
}
|
||||
}
|
||||
other => {
|
||||
errors.push(LoweringError::Other(format!(
|
||||
"Unknown diplomat attribute {other:?}: expected one of: `disable, rename`"
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
pub struct BackendAttrSupport {
|
||||
pub disabling: bool,
|
||||
pub renaming: bool,
|
||||
// more to be added: rename, namespace, etc
|
||||
}
|
||||
|
||||
/// Defined by backends when validating attributes
|
||||
pub trait AttributeValidator {
|
||||
/// The primary name of the backend, for use in diagnostics
|
||||
fn primary_name(&self) -> &str;
|
||||
/// Does this backend satisfy `cfg(backend_name)`?
|
||||
/// (Backends are allowed to satisfy multiple backend names, useful when there
|
||||
/// are multiple backends for a language)
|
||||
fn is_backend(&self, backend_name: &str) -> bool;
|
||||
/// does this backend satisfy cfg(name = value)?
|
||||
fn is_name_value(&self, name: &str, value: &str) -> bool;
|
||||
/// What backedn attrs does this support?
|
||||
fn attrs_supported(&self) -> BackendAttrSupport;
|
||||
|
||||
/// Provided, checks if type satisfies a `DiplomatBackendAttrCfg`
|
||||
fn satisfies_cfg(&self, cfg: &DiplomatBackendAttrCfg) -> bool {
|
||||
match *cfg {
|
||||
DiplomatBackendAttrCfg::Not(ref c) => !self.satisfies_cfg(c),
|
||||
DiplomatBackendAttrCfg::Any(ref cs) => cs.iter().any(|c| self.satisfies_cfg(c)),
|
||||
DiplomatBackendAttrCfg::All(ref cs) => cs.iter().all(|c| self.satisfies_cfg(c)),
|
||||
DiplomatBackendAttrCfg::Star => true,
|
||||
DiplomatBackendAttrCfg::BackendName(ref n) => self.is_backend(n),
|
||||
DiplomatBackendAttrCfg::NameValue(ref n, ref v) => self.is_name_value(n, v),
|
||||
}
|
||||
}
|
||||
|
||||
// Provided, constructs an attribute
|
||||
fn attr_from_ast(
|
||||
&self,
|
||||
ast: &ast::Attrs,
|
||||
context: AttributeContext,
|
||||
errors: &mut Vec<LoweringError>,
|
||||
) -> Attrs {
|
||||
Attrs::from_ast(ast, self, context, errors)
|
||||
}
|
||||
}
|
||||
|
||||
/// A basic attribute validator
|
||||
#[non_exhaustive]
|
||||
#[derive(Default)]
|
||||
pub struct BasicAttributeValidator {
|
||||
/// The primary name of this backend (should be unique, ideally)
|
||||
pub backend_name: String,
|
||||
/// The attributes supported
|
||||
pub support: BackendAttrSupport,
|
||||
/// Additional names for this backend
|
||||
pub other_backend_names: Vec<String>,
|
||||
/// override is_name_value()
|
||||
#[allow(clippy::type_complexity)] // dyn fn is not that complex
|
||||
pub is_name_value: Option<Box<dyn Fn(&str, &str) -> bool>>,
|
||||
}
|
||||
|
||||
impl BasicAttributeValidator {
|
||||
pub fn new(backend_name: &str) -> Self {
|
||||
BasicAttributeValidator {
|
||||
backend_name: backend_name.into(),
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AttributeValidator for BasicAttributeValidator {
|
||||
fn primary_name(&self) -> &str {
|
||||
&self.backend_name
|
||||
}
|
||||
fn is_backend(&self, backend_name: &str) -> bool {
|
||||
self.backend_name == backend_name
|
||||
|| self.other_backend_names.iter().any(|n| n == backend_name)
|
||||
}
|
||||
fn is_name_value(&self, name: &str, value: &str) -> bool {
|
||||
if let Some(ref nv) = self.is_name_value {
|
||||
nv(name, value)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
fn attrs_supported(&self) -> BackendAttrSupport {
|
||||
self.support
|
||||
}
|
||||
}
|
29
third_party/rust/diplomat_core/src/hir/defs.rs
vendored
29
third_party/rust/diplomat_core/src/hir/defs.rs
vendored
@ -1,14 +1,16 @@
|
||||
//! Type definitions for structs, output structs, opaque structs, and enums.
|
||||
|
||||
use super::{Everywhere, IdentBuf, Method, OutputOnly, TyPosition, Type};
|
||||
use super::{Attrs, Everywhere, IdentBuf, Method, OutputOnly, TyPosition, Type};
|
||||
use crate::ast::Docs;
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum ReturnableStructDef<'tcx> {
|
||||
Struct(&'tcx StructDef),
|
||||
OutStruct(&'tcx OutStructDef),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum TypeDef<'tcx> {
|
||||
Struct(&'tcx StructDef),
|
||||
OutStruct(&'tcx OutStructDef),
|
||||
@ -21,11 +23,13 @@ pub type OutStructDef = StructDef<OutputOnly>;
|
||||
|
||||
/// Structs that can be either inputs or outputs in methods.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct StructDef<P: TyPosition = Everywhere> {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
pub fields: Vec<StructField<P>>,
|
||||
pub methods: Vec<Method>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
/// A struct whose contents are opaque across the FFI boundary, and can only
|
||||
@ -37,19 +41,23 @@ pub struct StructDef<P: TyPosition = Everywhere> {
|
||||
///
|
||||
/// A struct marked with `#[diplomat::opaque]`.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct OpaqueDef {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
pub methods: Vec<Method>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
/// The enum type.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct EnumDef {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
pub variants: Vec<EnumVariant>,
|
||||
pub methods: Vec<Method>,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
/// A field on a [`OutStruct`]s.
|
||||
@ -57,6 +65,7 @@ pub type OutStructField = StructField<OutputOnly>;
|
||||
|
||||
/// A field on a [`Struct`]s.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct StructField<P: TyPosition = Everywhere> {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
@ -65,10 +74,12 @@ pub struct StructField<P: TyPosition = Everywhere> {
|
||||
|
||||
/// A variant of an [`Enum`].
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct EnumVariant {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
pub discriminant: isize,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
impl<P: TyPosition> StructDef<P> {
|
||||
@ -77,22 +88,25 @@ impl<P: TyPosition> StructDef<P> {
|
||||
name: IdentBuf,
|
||||
fields: Vec<StructField<P>>,
|
||||
methods: Vec<Method>,
|
||||
attrs: Attrs,
|
||||
) -> Self {
|
||||
Self {
|
||||
docs,
|
||||
name,
|
||||
fields,
|
||||
methods,
|
||||
attrs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OpaqueDef {
|
||||
pub(super) fn new(docs: Docs, name: IdentBuf, methods: Vec<Method>) -> Self {
|
||||
pub(super) fn new(docs: Docs, name: IdentBuf, methods: Vec<Method>, attrs: Attrs) -> Self {
|
||||
Self {
|
||||
docs,
|
||||
name,
|
||||
methods,
|
||||
attrs,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,12 +117,14 @@ impl EnumDef {
|
||||
name: IdentBuf,
|
||||
variants: Vec<EnumVariant>,
|
||||
methods: Vec<Method>,
|
||||
attrs: Attrs,
|
||||
) -> Self {
|
||||
Self {
|
||||
docs,
|
||||
name,
|
||||
variants,
|
||||
methods,
|
||||
attrs,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,4 +179,13 @@ impl<'tcx> TypeDef<'tcx> {
|
||||
Self::Enum(ty) => &ty.methods,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attrs(&self) -> &'tcx Attrs {
|
||||
match *self {
|
||||
Self::Struct(ty) => &ty.attrs,
|
||||
Self::OutStruct(ty) => &ty.attrs,
|
||||
Self::Opaque(ty) => &ty.attrs,
|
||||
Self::Enum(ty) => &ty.attrs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@
|
||||
//! [Nomicon]: https://doc.rust-lang.org/nomicon/lifetime-elision.html
|
||||
|
||||
use super::{
|
||||
lower_ident, Lifetime, LifetimeEnv, LoweringError, MaybeStatic, MethodLifetime, TypeLifetime,
|
||||
Lifetime, LifetimeEnv, LoweringContext, MaybeStatic, MethodLifetime, TypeLifetime,
|
||||
TypeLifetimes,
|
||||
};
|
||||
use crate::ast;
|
||||
@ -181,7 +181,7 @@ pub(super) struct BaseLifetimeLowerer<'ast> {
|
||||
/// is lowered into its HIR representation, if present. According to elision
|
||||
/// rules, this reference has the highest precedence as the lifetime that
|
||||
/// goes into elision in the output, and so it's checked first.
|
||||
pub struct SelfParamLifetimeLowerer<'ast> {
|
||||
pub(super) struct SelfParamLifetimeLowerer<'ast> {
|
||||
base: BaseLifetimeLowerer<'ast>,
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ pub struct SelfParamLifetimeLowerer<'ast> {
|
||||
/// didn't claim the potential output elided lifetime, then if there's a
|
||||
/// single lifetime (elided or not) in the inputs, it will claim the
|
||||
/// potential output elided lifetime.
|
||||
pub struct ParamLifetimeLowerer<'ast> {
|
||||
pub(super) struct ParamLifetimeLowerer<'ast> {
|
||||
elision_source: ElisionSource,
|
||||
base: BaseLifetimeLowerer<'ast>,
|
||||
}
|
||||
@ -205,7 +205,7 @@ pub struct ParamLifetimeLowerer<'ast> {
|
||||
/// that lifetime. If none did and there is elision in the output, then
|
||||
/// rustc should have errored and said the elision was ambiguous, meaning
|
||||
/// that state should be impossible so it panics.
|
||||
pub struct ReturnLifetimeLowerer<'ast> {
|
||||
pub(super) struct ReturnLifetimeLowerer<'ast> {
|
||||
elision_source: ElisionSource,
|
||||
base: BaseLifetimeLowerer<'ast>,
|
||||
}
|
||||
@ -246,14 +246,11 @@ impl<'ast> BaseLifetimeLowerer<'ast> {
|
||||
|
||||
impl<'ast> SelfParamLifetimeLowerer<'ast> {
|
||||
/// Returns a new [`SelfParamLifetimeLowerer`].
|
||||
pub fn new(
|
||||
lifetime_env: &'ast ast::LifetimeEnv,
|
||||
errors: &mut Vec<LoweringError>,
|
||||
) -> Option<Self> {
|
||||
pub fn new(lifetime_env: &'ast ast::LifetimeEnv, ctx: &mut LoweringContext) -> Option<Self> {
|
||||
let mut hir_nodes = Some(SmallVec::new());
|
||||
|
||||
for ast_node in lifetime_env.nodes.iter() {
|
||||
let lifetime = lower_ident(ast_node.lifetime.name(), "named lifetime", errors);
|
||||
let lifetime = ctx.lower_ident(ast_node.lifetime.name(), "named lifetime");
|
||||
match (lifetime, &mut hir_nodes) {
|
||||
(Some(lifetime), Some(hir_nodes)) => {
|
||||
hir_nodes.push(Lifetime::new(
|
||||
@ -420,7 +417,7 @@ mod tests {
|
||||
|
||||
env.insert(crate::ast::Path::empty(), top_symbols);
|
||||
|
||||
let tcx = crate::hir::TypeContext::from_ast(&env).unwrap();
|
||||
let tcx = crate::hir::TypeContext::from_ast(&env, crate::hir::BasicAttributeValidator::new("test-backend")).unwrap();
|
||||
|
||||
tcx
|
||||
}}
|
||||
|
@ -96,6 +96,7 @@ where
|
||||
/// Wrapper type for `TypeLifetime` and `MethodLifetime`, indicating that it may
|
||||
/// be the `'static` lifetime.
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[allow(clippy::exhaustive_enums)] // this will only ever have two variants
|
||||
pub enum MaybeStatic<T> {
|
||||
Static,
|
||||
NonStatic(T),
|
||||
|
1174
third_party/rust/diplomat_core/src/hir/lowering.rs
vendored
1174
third_party/rust/diplomat_core/src/hir/lowering.rs
vendored
File diff suppressed because it is too large
Load Diff
@ -5,12 +5,13 @@ use std::fmt::{self, Write};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::{
|
||||
paths, Docs, Ident, IdentBuf, LifetimeEnv, MaybeStatic, MethodLifetime, MethodLifetimes,
|
||||
paths, Attrs, Docs, Ident, IdentBuf, LifetimeEnv, MaybeStatic, MethodLifetime, MethodLifetimes,
|
||||
OutType, SelfType, Slice, Type, TypeContext, TypeLifetime, TypeLifetimes,
|
||||
};
|
||||
|
||||
/// A method exposed to Diplomat.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Method {
|
||||
pub docs: Docs,
|
||||
pub name: IdentBuf,
|
||||
@ -19,10 +20,12 @@ pub struct Method {
|
||||
pub param_self: Option<ParamSelf>,
|
||||
pub params: Vec<Param>,
|
||||
pub output: ReturnType,
|
||||
pub attrs: Attrs,
|
||||
}
|
||||
|
||||
/// Type that the method returns.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum SuccessType {
|
||||
Writeable,
|
||||
OutType(OutType),
|
||||
@ -30,6 +33,7 @@ pub enum SuccessType {
|
||||
|
||||
/// Whether or not the method returns a value or a result.
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // this only exists for fallible/infallible, breaking changes for more complex returns are ok
|
||||
pub enum ReturnType {
|
||||
Infallible(Option<SuccessType>),
|
||||
Fallible(Option<SuccessType>, Option<OutType>),
|
||||
@ -37,12 +41,14 @@ pub enum ReturnType {
|
||||
|
||||
/// The `self` parameter of a method.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct ParamSelf {
|
||||
pub ty: SelfType,
|
||||
}
|
||||
|
||||
/// A parameter in a method.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Param {
|
||||
pub name: IdentBuf,
|
||||
pub ty: Type,
|
||||
|
@ -2,6 +2,7 @@
|
||||
//!
|
||||
//! Enabled with the `"hir"` Cargo feature
|
||||
|
||||
mod attrs;
|
||||
mod defs;
|
||||
mod elision;
|
||||
mod lifetimes;
|
||||
@ -12,6 +13,7 @@ mod primitives;
|
||||
mod ty_position;
|
||||
mod type_context;
|
||||
mod types;
|
||||
pub use attrs::*;
|
||||
pub use defs::*;
|
||||
pub(super) use elision::*;
|
||||
pub use lifetimes::*;
|
||||
|
@ -5,6 +5,7 @@ use super::{
|
||||
|
||||
/// Path to a struct that may appear as an output.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum ReturnableStructPath {
|
||||
Struct(StructPath),
|
||||
OutStruct(OutStructPath),
|
||||
@ -15,6 +16,7 @@ pub type OutStructPath = StructPath<OutputOnly>;
|
||||
|
||||
/// Path to a struct that can be used in inputs and outputs.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct StructPath<P: TyPosition = Everywhere> {
|
||||
pub lifetimes: TypeLifetimes,
|
||||
pub tcx_id: P::StructId,
|
||||
@ -35,6 +37,7 @@ pub struct StructPath<P: TyPosition = Everywhere> {
|
||||
/// 3. `OpaquePath<NonOptional, Borrow>`: Opaques in the `&self` position, which
|
||||
/// cannot be optional and must be borrowed for the same reason as above.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct OpaquePath<Opt, Owner> {
|
||||
pub lifetimes: TypeLifetimes,
|
||||
pub optional: Opt,
|
||||
@ -46,6 +49,7 @@ pub struct OpaquePath<Opt, Owner> {
|
||||
pub struct Optional(pub(super) bool);
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[allow(clippy::exhaustive_structs)] // marker type
|
||||
pub struct NonOptional;
|
||||
|
||||
impl<Owner: OpaqueOwner> OpaquePath<Optional, Owner> {
|
||||
@ -79,6 +83,7 @@ impl<Opt> OpaquePath<Opt, Borrow> {
|
||||
|
||||
/// Path to an enum.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct EnumPath {
|
||||
pub tcx_id: EnumId,
|
||||
}
|
||||
@ -87,6 +92,7 @@ pub struct EnumPath {
|
||||
///
|
||||
/// Since owned opaques cannot be used as inputs, this only appears in output types.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // only two answers to this question
|
||||
pub enum MaybeOwn {
|
||||
Own,
|
||||
Borrow(Borrow),
|
||||
|
@ -3,6 +3,7 @@ use crate::ast;
|
||||
|
||||
/// 8, 16, 32, and 64-bit signed and unsigned integers.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these
|
||||
pub enum IntType {
|
||||
I8,
|
||||
I16,
|
||||
@ -16,6 +17,7 @@ pub enum IntType {
|
||||
|
||||
/// Platform-dependent signed and unsigned size types.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these
|
||||
pub enum IntSizeType {
|
||||
Isize,
|
||||
Usize,
|
||||
@ -23,6 +25,7 @@ pub enum IntSizeType {
|
||||
|
||||
/// 128-bit signed and unsigned integers.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these
|
||||
pub enum Int128Type {
|
||||
I128,
|
||||
U128,
|
||||
@ -30,6 +33,7 @@ pub enum Int128Type {
|
||||
|
||||
/// 32 and 64-bit floating point numbers.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these
|
||||
pub enum FloatType {
|
||||
F32,
|
||||
F64,
|
||||
@ -37,6 +41,7 @@ pub enum FloatType {
|
||||
|
||||
/// All primitive types.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(clippy::exhaustive_enums)] // there are only these
|
||||
pub enum PrimitiveType {
|
||||
Bool,
|
||||
Char,
|
||||
|
@ -29,7 +29,7 @@ TypeContext {
|
||||
],
|
||||
},
|
||||
optional: Optional(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
owner: Own,
|
||||
tcx_id: OpaqueId(
|
||||
@ -95,8 +95,16 @@ TypeContext {
|
||||
),
|
||||
),
|
||||
),
|
||||
attrs: Attrs {
|
||||
disable: false,
|
||||
rename: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
attrs: Attrs {
|
||||
disable: false,
|
||||
rename: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
structs: [
|
||||
@ -190,8 +198,16 @@ TypeContext {
|
||||
),
|
||||
),
|
||||
),
|
||||
attrs: Attrs {
|
||||
disable: false,
|
||||
rename: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
attrs: Attrs {
|
||||
disable: false,
|
||||
rename: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
opaques: [
|
||||
@ -202,6 +218,10 @@ TypeContext {
|
||||
),
|
||||
name: "Opaque",
|
||||
methods: [],
|
||||
attrs: Attrs {
|
||||
disable: false,
|
||||
rename: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
enums: [],
|
||||
|
@ -109,6 +109,7 @@ pub trait TyPosition: Debug + Copy {
|
||||
///
|
||||
/// The complement of this type is [`OutputOnly`].
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct Everywhere;
|
||||
|
||||
/// One of two types implementing [`TyPosition`], representing types that can
|
||||
@ -116,6 +117,7 @@ pub struct Everywhere;
|
||||
///
|
||||
/// The complement of this type is [`Everywhere`].
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct OutputOnly;
|
||||
|
||||
impl TyPosition for Everywhere {
|
||||
|
@ -1,6 +1,9 @@
|
||||
//! Store all the types contained in the HIR.
|
||||
|
||||
use super::{EnumDef, LoweringError, OpaqueDef, OutStructDef, StructDef, TypeDef, TypeLowerer};
|
||||
use super::{
|
||||
AttributeValidator, EnumDef, LoweringContext, LoweringError, OpaqueDef, OutStructDef,
|
||||
StructDef, TypeDef,
|
||||
};
|
||||
#[allow(unused_imports)] // use in docs links
|
||||
use crate::hir;
|
||||
use crate::{ast, Env};
|
||||
@ -34,6 +37,7 @@ pub struct OpaqueId(usize);
|
||||
pub struct EnumId(usize);
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum TypeId {
|
||||
Struct(StructId),
|
||||
OutStruct(OutStructId),
|
||||
@ -109,7 +113,10 @@ impl TypeContext {
|
||||
}
|
||||
|
||||
/// Lower the AST to the HIR while simultaneously performing validation.
|
||||
pub fn from_ast(env: &Env) -> Result<Self, Vec<LoweringError>> {
|
||||
pub fn from_ast(
|
||||
env: &Env,
|
||||
attr_validator: impl AttributeValidator + 'static,
|
||||
) -> Result<Self, Vec<LoweringError>> {
|
||||
let mut ast_out_structs = SmallVec::<[_; 16]>::new();
|
||||
let mut ast_structs = SmallVec::<[_; 16]>::new();
|
||||
let mut ast_opaques = SmallVec::<[_; 16]>::new();
|
||||
@ -139,12 +146,19 @@ impl TypeContext {
|
||||
&ast_opaques[..],
|
||||
&ast_enums[..],
|
||||
);
|
||||
let attr_validator = Box::new(attr_validator);
|
||||
|
||||
let out_structs =
|
||||
OutStructDef::lower_all(&ast_out_structs[..], &lookup_id, env, &mut errors);
|
||||
let structs = StructDef::lower_all(&ast_structs[..], &lookup_id, env, &mut errors);
|
||||
let opaques = OpaqueDef::lower_all(&ast_opaques[..], &lookup_id, env, &mut errors);
|
||||
let enums = EnumDef::lower_all(&ast_enums[..], &lookup_id, env, &mut errors);
|
||||
let mut ctx = LoweringContext {
|
||||
lookup_id: &lookup_id,
|
||||
env,
|
||||
errors: &mut errors,
|
||||
attr_validator,
|
||||
};
|
||||
|
||||
let out_structs = ctx.lower_all_out_structs(&ast_out_structs[..]);
|
||||
let structs = ctx.lower_all_structs(&ast_structs[..]);
|
||||
let opaques = ctx.lower_all_opaques(&ast_opaques[..]);
|
||||
let enums = ctx.lower_all_enums(&ast_enums[..]);
|
||||
|
||||
match (out_structs, structs, opaques, enums) {
|
||||
(Some(out_structs), Some(structs), Some(opaques), Some(enums)) => {
|
||||
|
16
third_party/rust/diplomat_core/src/hir/types.rs
vendored
16
third_party/rust/diplomat_core/src/hir/types.rs
vendored
@ -12,6 +12,7 @@ pub type OutType = Type<OutputOnly>;
|
||||
|
||||
/// Type that may be used as input or output.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Type<P: TyPosition = Everywhere> {
|
||||
Primitive(PrimitiveType),
|
||||
Opaque(OpaquePath<Optional, P::OpaqueOwnership>),
|
||||
@ -22,6 +23,7 @@ pub enum Type<P: TyPosition = Everywhere> {
|
||||
|
||||
/// Type that can appear in the `self` position.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum SelfType {
|
||||
Opaque(OpaquePath<NonOptional, Borrow>),
|
||||
Struct(StructPath),
|
||||
@ -29,6 +31,7 @@ pub enum SelfType {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Slice {
|
||||
/// A string slice, e.g. `&str`.
|
||||
Str(MaybeStatic<TypeLifetime>),
|
||||
@ -46,6 +49,7 @@ pub enum Slice {
|
||||
// involve getting the implicit lifetime thing to be understood by Diplomat, but
|
||||
// should be doable.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub struct Borrow {
|
||||
pub lifetime: MaybeStatic<TypeLifetime>,
|
||||
pub mutability: Mutability,
|
||||
@ -68,6 +72,18 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
impl SelfType {
|
||||
/// Returns whether the self parameter is borrowed immutably.
|
||||
///
|
||||
/// Curently this can only happen with opaque types.
|
||||
pub fn is_immutably_borrowed(&self) -> bool {
|
||||
match self {
|
||||
SelfType::Opaque(opaque_path) => opaque_path.owner.mutability == Mutability::Immutable,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Slice {
|
||||
/// Returns the [`TypeLifetime`] contained in either the `Str` or `Primitive`
|
||||
/// variant.
|
||||
|
1
third_party/rust/diplomat_core/src/lib.rs
vendored
1
third_party/rust/diplomat_core/src/lib.rs
vendored
@ -4,6 +4,7 @@
|
||||
//! extracting APIs.
|
||||
|
||||
#![allow(clippy::needless_lifetimes)] // we use named lifetimes for clarity
|
||||
#![warn(clippy::exhaustive_structs, clippy::exhaustive_enums)]
|
||||
|
||||
pub mod ast;
|
||||
#[cfg(feature = "hir")]
|
||||
|
File diff suppressed because one or more lines are too long
248
third_party/rust/icu_capi/Cargo.toml
vendored
248
third_party/rust/icu_capi/Cargo.toml
vendored
@ -1,248 +0,0 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "icu_capi"
|
||||
version = "1.2.2"
|
||||
authors = ["The ICU4X Project Developers"]
|
||||
include = [
|
||||
"src/**/*",
|
||||
"examples/**/*",
|
||||
"benches/**/*",
|
||||
"tests/**/*",
|
||||
"**/include/**/*",
|
||||
"Cargo.toml",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
]
|
||||
description = "C interface to ICU4X"
|
||||
readme = "README.md"
|
||||
categories = ["internationalization"]
|
||||
license = "Unicode-DFS-2016"
|
||||
repository = "https://github.com/unicode-org/icu4x"
|
||||
resolver = "2"
|
||||
|
||||
[package.metadata.cargo-all-features]
|
||||
denylist = [
|
||||
"bench",
|
||||
"logging",
|
||||
"cpp_default",
|
||||
"wasm_default",
|
||||
]
|
||||
max_combination_size = 2
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[dependencies.diplomat]
|
||||
version = "0.5.2"
|
||||
|
||||
[dependencies.diplomat-runtime]
|
||||
version = "0.5.2"
|
||||
|
||||
[dependencies.fixed_decimal]
|
||||
version = "0.5.2"
|
||||
features = ["ryu"]
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_calendar]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_collator]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_collections]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_datetime]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_decimal]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_displaynames]
|
||||
version = "0.10.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_list]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_locid]
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.icu_locid_transform]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_normalizer]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_plurals]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_properties]
|
||||
version = "1.2.0"
|
||||
features = ["bidi"]
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_provider]
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.icu_provider_adapters]
|
||||
version = "1.2.0"
|
||||
|
||||
[dependencies.icu_provider_blob]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_segmenter]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_testdata]
|
||||
version = "1.2.0"
|
||||
features = ["icu_segmenter"]
|
||||
optional = true
|
||||
|
||||
[dependencies.icu_timezone]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.tinystr]
|
||||
version = "0.7.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.unicode-bidi]
|
||||
version = "0.3.13"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.writeable]
|
||||
version = "0.5.1"
|
||||
|
||||
[features]
|
||||
any_provider = []
|
||||
buffer_provider = [
|
||||
"dep:icu_provider_blob",
|
||||
"dep:serde",
|
||||
"icu_calendar?/serde",
|
||||
"icu_collator?/serde",
|
||||
"icu_datetime?/serde",
|
||||
"icu_decimal?/serde",
|
||||
"icu_displaynames?/serde",
|
||||
"icu_list?/serde",
|
||||
"icu_locid_transform?/serde",
|
||||
"icu_locid/serde",
|
||||
"icu_normalizer?/serde",
|
||||
"icu_plurals?/serde",
|
||||
"icu_properties?/serde",
|
||||
"icu_provider/serde",
|
||||
"icu_provider_adapters/serde",
|
||||
"icu_segmenter?/serde",
|
||||
"icu_testdata?/buffer",
|
||||
"icu_timezone?/serde",
|
||||
]
|
||||
cpp_default = [
|
||||
"provider_test",
|
||||
"logging",
|
||||
"simple_logger",
|
||||
]
|
||||
default = [
|
||||
"any_provider",
|
||||
"default_components",
|
||||
]
|
||||
default_components = [
|
||||
"icu_calendar",
|
||||
"icu_collator",
|
||||
"icu_datetime",
|
||||
"icu_decimal",
|
||||
"icu_list",
|
||||
"icu_locid_transform",
|
||||
"icu_normalizer",
|
||||
"icu_plurals",
|
||||
"icu_properties",
|
||||
"icu_segmenter",
|
||||
"icu_timezone",
|
||||
]
|
||||
icu_calendar = ["dep:icu_calendar"]
|
||||
icu_collator = ["dep:icu_collator"]
|
||||
icu_datetime = [
|
||||
"dep:icu_datetime",
|
||||
"dep:icu_calendar",
|
||||
"dep:icu_timezone",
|
||||
"dep:icu_decimal",
|
||||
"dep:icu_plurals",
|
||||
]
|
||||
icu_decimal = [
|
||||
"dep:icu_decimal",
|
||||
"dep:fixed_decimal",
|
||||
]
|
||||
icu_displaynames = ["dep:icu_displaynames"]
|
||||
icu_list = ["dep:icu_list"]
|
||||
icu_locid_transform = ["dep:icu_locid_transform"]
|
||||
icu_normalizer = ["dep:icu_normalizer"]
|
||||
icu_plurals = [
|
||||
"dep:icu_plurals",
|
||||
"dep:fixed_decimal",
|
||||
]
|
||||
icu_properties = [
|
||||
"dep:icu_properties",
|
||||
"dep:icu_collections",
|
||||
"dep:unicode-bidi",
|
||||
]
|
||||
icu_segmenter = ["dep:icu_segmenter"]
|
||||
icu_timezone = [
|
||||
"dep:icu_timezone",
|
||||
"dep:icu_calendar",
|
||||
]
|
||||
logging = [
|
||||
"icu_provider/log_error_context",
|
||||
"dep:log",
|
||||
]
|
||||
provider_fs = [
|
||||
"dep:icu_provider_fs",
|
||||
"buffer_provider",
|
||||
]
|
||||
provider_test = ["dep:icu_testdata"]
|
||||
simple_logger = ["dep:simple_logger"]
|
||||
wasm_default = [
|
||||
"buffer_provider",
|
||||
"logging",
|
||||
]
|
||||
|
||||
[target."cfg(not(any(target_arch = \"wasm32\", target_os = \"none\")))".dependencies.icu_provider_fs]
|
||||
version = "1.2.0"
|
||||
optional = true
|
||||
|
||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.log]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
|
||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.simple_logger]
|
||||
version = "4.1.0"
|
||||
optional = true
|
||||
|
||||
[target."cfg(target_arch = \"wasm32\")".dependencies.log]
|
||||
version = "0.4"
|
51
third_party/rust/icu_capi/LICENSE
vendored
51
third_party/rust/icu_capi/LICENSE
vendored
@ -1,51 +0,0 @@
|
||||
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
|
||||
|
||||
See Terms of Use <https://www.unicode.org/copyright.html>
|
||||
for definitions of Unicode Inc.’s Data Files and Software.
|
||||
|
||||
NOTICE TO USER: Carefully read the following legal agreement.
|
||||
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
|
||||
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
|
||||
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
|
||||
TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
|
||||
THE DATA FILES OR SOFTWARE.
|
||||
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright © 1991-2022 Unicode, Inc. All rights reserved.
|
||||
Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation
|
||||
(the "Data Files") or Unicode software and any associated documentation
|
||||
(the "Software") to deal in the Data Files or Software
|
||||
without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, and/or sell copies of
|
||||
the Data Files or Software, and to permit persons to whom the Data Files
|
||||
or Software are furnished to do so, provided that either
|
||||
(a) this copyright and permission notice appear with all copies
|
||||
of the Data Files or Software, or
|
||||
(b) this copyright and permission notice appear in associated
|
||||
Documentation.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
|
||||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale,
|
||||
use or other dealings in these Data Files or Software without prior
|
||||
written authorization of the copyright holder.
|
||||
|
||||
—
|
||||
|
||||
Portions of ICU4X may have been adapted from ICU4C and/or ICU4J.
|
||||
ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others.
|
26
third_party/rust/icu_capi/README.md
vendored
26
third_party/rust/icu_capi/README.md
vendored
@ -1,26 +0,0 @@
|
||||
# icu_capi [![crates.io](https://img.shields.io/crates/v/icu_capi)](https://crates.io/crates/icu_capi)
|
||||
|
||||
This crate contains the source of truth for the [Diplomat](https://github.com/rust-diplomat/diplomat)-generated
|
||||
FFI bindings. This generates the C, C++, JavaScript, and TypeScript bindings. This crate also contains the `extern "C"`
|
||||
FFI for ICU4X.
|
||||
|
||||
While the types in this crate are public, APIs from this crate are *not intended to be used from Rust*
|
||||
and as such this crate may unpredictably change its Rust API across compatible semver versions. The `extern "C"` APIs exposed
|
||||
by this crate, while not directly documented, are stable within the same major semver version, as are the bindings exposed under
|
||||
the `cpp/` and `js/` folders.
|
||||
|
||||
This crate may still be explored for documentation on docs.rs, and there are generated language-specific docs available as well.
|
||||
C++ has sphinx docs in `cpp/docs/`, and the header files also contain documentation comments. The JS version has sphinx docs under
|
||||
`js/docs`, and the TypeScript sources in `js/include` are compatible with `tsdoc`.
|
||||
|
||||
This crate is `no_std` and will not typically build as a staticlib on its own. If you wish to link to it you should prefer
|
||||
using `icu_capi_staticlib`, or for more esoteric platforms you may write a shim crate depending on this crate that hooks in
|
||||
an allocator and panic hook.
|
||||
|
||||
More information on using ICU4X from C++ can be found in [our tutorial].
|
||||
|
||||
[our tutorial]: https://github.com/unicode-org/icu4x/blob/main/docs/tutorials/cpp.md
|
||||
|
||||
## More Information
|
||||
|
||||
For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
|
18
third_party/rust/icu_capi/c/README.md
vendored
18
third_party/rust/icu_capi/c/README.md
vendored
@ -1,18 +0,0 @@
|
||||
# C FFI for ICU4X
|
||||
|
||||
This folder contains the C FFI for ICU4X. To re-generate the bindings run:
|
||||
|
||||
```sh
|
||||
cargo make diplomat-install
|
||||
cargo make diplomat-gen-c
|
||||
```
|
||||
|
||||
Or re-generate all of the bindings:
|
||||
|
||||
```sh
|
||||
cargo make diplomat-gen
|
||||
```
|
||||
|
||||
## More Information
|
||||
|
||||
For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
|
@ -1,8 +0,0 @@
|
||||
# Tiny FixedDecimal FFI Demo
|
||||
|
||||
This example contains tooling to build a size-optimized binary using FixedDecimal and FixedDecimalFormatter in C over FFI.
|
||||
|
||||
Prerequisites: `clang` and `lld` 14. `apt-get install clang lld` *might* work, but if you run into errors, refer to the following thread for tips:
|
||||
|
||||
https://github.com/rust-lang/rust/issues/60059
|
||||
|
@ -1,30 +0,0 @@
|
||||
#ifndef CodePointRangeIterator_H
|
||||
#define CodePointRangeIterator_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct CodePointRangeIterator CodePointRangeIterator;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "CodePointRangeIteratorResult.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CodePointRangeIteratorResult CodePointRangeIterator_next(CodePointRangeIterator* self);
|
||||
void CodePointRangeIterator_destroy(CodePointRangeIterator* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef CodePointRangeIteratorResult_H
|
||||
#define CodePointRangeIteratorResult_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct CodePointRangeIteratorResult {
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
bool done;
|
||||
} CodePointRangeIteratorResult;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CodePointRangeIteratorResult_destroy(CodePointRangeIteratorResult* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
#ifndef ICU4XAnyCalendarKind_H
|
||||
#define ICU4XAnyCalendarKind_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XAnyCalendarKind {
|
||||
ICU4XAnyCalendarKind_Iso = 0,
|
||||
ICU4XAnyCalendarKind_Gregorian = 1,
|
||||
ICU4XAnyCalendarKind_Buddhist = 2,
|
||||
ICU4XAnyCalendarKind_Japanese = 3,
|
||||
ICU4XAnyCalendarKind_JapaneseExtended = 4,
|
||||
ICU4XAnyCalendarKind_Ethiopian = 5,
|
||||
ICU4XAnyCalendarKind_EthiopianAmeteAlem = 6,
|
||||
ICU4XAnyCalendarKind_Indian = 7,
|
||||
ICU4XAnyCalendarKind_Coptic = 8,
|
||||
} ICU4XAnyCalendarKind;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XLocale.h"
|
||||
#include "diplomat_result_ICU4XAnyCalendarKind_void.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_ICU4XAnyCalendarKind_void ICU4XAnyCalendarKind_get_for_locale(const ICU4XLocale* locale);
|
||||
|
||||
diplomat_result_ICU4XAnyCalendarKind_void ICU4XAnyCalendarKind_get_for_bcp47(const char* s_data, size_t s_len);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XAnyCalendarKind_bcp47(ICU4XAnyCalendarKind self, DiplomatWriteable* write);
|
||||
void ICU4XAnyCalendarKind_destroy(ICU4XAnyCalendarKind* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
45
third_party/rust/icu_capi/c/include/ICU4XBidi.h
vendored
45
third_party/rust/icu_capi/c/include/ICU4XBidi.h
vendored
@ -1,45 +0,0 @@
|
||||
#ifndef ICU4XBidi_H
|
||||
#define ICU4XBidi_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XBidi ICU4XBidi;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XBidi_ICU4XError.h"
|
||||
#include "ICU4XBidiInfo.h"
|
||||
#include "ICU4XReorderedIndexMap.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XBidi_ICU4XError ICU4XBidi_create(const ICU4XDataProvider* provider);
|
||||
|
||||
ICU4XBidiInfo* ICU4XBidi_for_text(const ICU4XBidi* self, const char* text_data, size_t text_len, uint8_t default_level);
|
||||
|
||||
ICU4XReorderedIndexMap* ICU4XBidi_reorder_visual(const ICU4XBidi* self, const uint8_t* levels_data, size_t levels_len);
|
||||
|
||||
bool ICU4XBidi_level_is_rtl(uint8_t level);
|
||||
|
||||
bool ICU4XBidi_level_is_ltr(uint8_t level);
|
||||
|
||||
uint8_t ICU4XBidi_level_rtl();
|
||||
|
||||
uint8_t ICU4XBidi_level_ltr();
|
||||
void ICU4XBidi_destroy(ICU4XBidi* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef ICU4XBidiDirection_H
|
||||
#define ICU4XBidiDirection_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XBidiDirection {
|
||||
ICU4XBidiDirection_Ltr = 0,
|
||||
ICU4XBidiDirection_Rtl = 1,
|
||||
ICU4XBidiDirection_Mixed = 2,
|
||||
} ICU4XBidiDirection;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XBidiDirection_destroy(ICU4XBidiDirection* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
#ifndef ICU4XBidiInfo_H
|
||||
#define ICU4XBidiInfo_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XBidiInfo ICU4XBidiInfo;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XBidiParagraph.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t ICU4XBidiInfo_paragraph_count(const ICU4XBidiInfo* self);
|
||||
|
||||
ICU4XBidiParagraph* ICU4XBidiInfo_paragraph_at(const ICU4XBidiInfo* self, size_t n);
|
||||
|
||||
size_t ICU4XBidiInfo_size(const ICU4XBidiInfo* self);
|
||||
|
||||
uint8_t ICU4XBidiInfo_level_at(const ICU4XBidiInfo* self, size_t pos);
|
||||
void ICU4XBidiInfo_destroy(ICU4XBidiInfo* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
#ifndef ICU4XBidiParagraph_H
|
||||
#define ICU4XBidiParagraph_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XBidiParagraph ICU4XBidiParagraph;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#include "ICU4XBidiDirection.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XBidiParagraph_set_paragraph_in_text(ICU4XBidiParagraph* self, size_t n);
|
||||
|
||||
ICU4XBidiDirection ICU4XBidiParagraph_direction(const ICU4XBidiParagraph* self);
|
||||
|
||||
size_t ICU4XBidiParagraph_size(const ICU4XBidiParagraph* self);
|
||||
|
||||
size_t ICU4XBidiParagraph_range_start(const ICU4XBidiParagraph* self);
|
||||
|
||||
size_t ICU4XBidiParagraph_range_end(const ICU4XBidiParagraph* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XBidiParagraph_reorder_line(const ICU4XBidiParagraph* self, size_t range_start, size_t range_end, DiplomatWriteable* out);
|
||||
|
||||
uint8_t ICU4XBidiParagraph_level_at(const ICU4XBidiParagraph* self, size_t pos);
|
||||
void ICU4XBidiParagraph_destroy(ICU4XBidiParagraph* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,37 +0,0 @@
|
||||
#ifndef ICU4XCalendar_H
|
||||
#define ICU4XCalendar_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCalendar ICU4XCalendar;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "ICU4XLocale.h"
|
||||
#include "diplomat_result_box_ICU4XCalendar_ICU4XError.h"
|
||||
#include "ICU4XAnyCalendarKind.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCalendar_ICU4XError ICU4XCalendar_create_for_locale(const ICU4XDataProvider* provider, const ICU4XLocale* locale);
|
||||
|
||||
diplomat_result_box_ICU4XCalendar_ICU4XError ICU4XCalendar_create_for_kind(const ICU4XDataProvider* provider, ICU4XAnyCalendarKind kind);
|
||||
|
||||
ICU4XAnyCalendarKind ICU4XCalendar_kind(const ICU4XCalendar* self);
|
||||
void ICU4XCalendar_destroy(ICU4XCalendar* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,35 +0,0 @@
|
||||
#ifndef ICU4XCanonicalCombiningClassMap_H
|
||||
#define ICU4XCanonicalCombiningClassMap_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCanonicalCombiningClassMap ICU4XCanonicalCombiningClassMap;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCanonicalCombiningClassMap_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCanonicalCombiningClassMap_ICU4XError ICU4XCanonicalCombiningClassMap_create(const ICU4XDataProvider* provider);
|
||||
|
||||
uint8_t ICU4XCanonicalCombiningClassMap_get(const ICU4XCanonicalCombiningClassMap* self, char32_t ch);
|
||||
|
||||
uint8_t ICU4XCanonicalCombiningClassMap_get32(const ICU4XCanonicalCombiningClassMap* self, uint32_t ch);
|
||||
void ICU4XCanonicalCombiningClassMap_destroy(ICU4XCanonicalCombiningClassMap* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
#ifndef ICU4XCanonicalComposition_H
|
||||
#define ICU4XCanonicalComposition_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCanonicalComposition ICU4XCanonicalComposition;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCanonicalComposition_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCanonicalComposition_ICU4XError ICU4XCanonicalComposition_create(const ICU4XDataProvider* provider);
|
||||
|
||||
char32_t ICU4XCanonicalComposition_compose(const ICU4XCanonicalComposition* self, char32_t starter, char32_t second);
|
||||
void ICU4XCanonicalComposition_destroy(ICU4XCanonicalComposition* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
#ifndef ICU4XCanonicalDecomposition_H
|
||||
#define ICU4XCanonicalDecomposition_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCanonicalDecomposition ICU4XCanonicalDecomposition;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCanonicalDecomposition_ICU4XError.h"
|
||||
#include "ICU4XDecomposed.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCanonicalDecomposition_ICU4XError ICU4XCanonicalDecomposition_create(const ICU4XDataProvider* provider);
|
||||
|
||||
ICU4XDecomposed ICU4XCanonicalDecomposition_decompose(const ICU4XCanonicalDecomposition* self, char32_t c);
|
||||
void ICU4XCanonicalDecomposition_destroy(ICU4XCanonicalDecomposition* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
#ifndef ICU4XCodePointMapData16_H
|
||||
#define ICU4XCodePointMapData16_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCodePointMapData16 ICU4XCodePointMapData16;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "CodePointRangeIterator.h"
|
||||
#include "ICU4XCodePointSetData.h"
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCodePointMapData16_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint16_t ICU4XCodePointMapData16_get(const ICU4XCodePointMapData16* self, char32_t cp);
|
||||
|
||||
uint16_t ICU4XCodePointMapData16_get32(const ICU4XCodePointMapData16* self, uint32_t cp);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointMapData16_iter_ranges_for_value(const ICU4XCodePointMapData16* self, uint16_t value);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointMapData16_iter_ranges_for_value_complemented(const ICU4XCodePointMapData16* self, uint16_t value);
|
||||
|
||||
ICU4XCodePointSetData* ICU4XCodePointMapData16_get_set_for_value(const ICU4XCodePointMapData16* self, uint16_t value);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData16_ICU4XError ICU4XCodePointMapData16_load_script(const ICU4XDataProvider* provider);
|
||||
void ICU4XCodePointMapData16_destroy(ICU4XCodePointMapData16* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,59 +0,0 @@
|
||||
#ifndef ICU4XCodePointMapData8_H
|
||||
#define ICU4XCodePointMapData8_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCodePointMapData8 ICU4XCodePointMapData8;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "CodePointRangeIterator.h"
|
||||
#include "ICU4XCodePointSetData.h"
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCodePointMapData8_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint8_t ICU4XCodePointMapData8_get(const ICU4XCodePointMapData8* self, char32_t cp);
|
||||
|
||||
uint8_t ICU4XCodePointMapData8_get32(const ICU4XCodePointMapData8* self, uint32_t cp);
|
||||
|
||||
uint32_t ICU4XCodePointMapData8_general_category_to_mask(uint8_t gc);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointMapData8_iter_ranges_for_value(const ICU4XCodePointMapData8* self, uint8_t value);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointMapData8_iter_ranges_for_value_complemented(const ICU4XCodePointMapData8* self, uint8_t value);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointMapData8_iter_ranges_for_mask(const ICU4XCodePointMapData8* self, uint32_t mask);
|
||||
|
||||
ICU4XCodePointSetData* ICU4XCodePointMapData8_get_set_for_value(const ICU4XCodePointMapData8* self, uint8_t value);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_general_category(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_bidi_class(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_east_asian_width(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_line_break(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_try_grapheme_cluster_break(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_word_break(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointMapData8_ICU4XError ICU4XCodePointMapData8_load_sentence_break(const ICU4XDataProvider* provider);
|
||||
void ICU4XCodePointMapData8_destroy(ICU4XCodePointMapData8* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,172 +0,0 @@
|
||||
#ifndef ICU4XCodePointSetData_H
|
||||
#define ICU4XCodePointSetData_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCodePointSetData ICU4XCodePointSetData;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "CodePointRangeIterator.h"
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XCodePointSetData_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool ICU4XCodePointSetData_contains(const ICU4XCodePointSetData* self, char32_t cp);
|
||||
|
||||
bool ICU4XCodePointSetData_contains32(const ICU4XCodePointSetData* self, uint32_t cp);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointSetData_iter_ranges(const ICU4XCodePointSetData* self);
|
||||
|
||||
CodePointRangeIterator* ICU4XCodePointSetData_iter_ranges_complemented(const ICU4XCodePointSetData* self);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_for_general_category_group(const ICU4XDataProvider* provider, uint32_t group);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_ascii_hex_digit(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_alnum(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_alphabetic(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_bidi_control(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_bidi_mirrored(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_blank(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_cased(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_case_ignorable(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_full_composition_exclusion(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_casefolded(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_casemapped(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_nfkc_casefolded(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_lowercased(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_titlecased(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_changes_when_uppercased(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_dash(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_deprecated(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_default_ignorable_code_point(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_diacritic(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_emoji_modifier_base(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_emoji_component(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_emoji_modifier(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_emoji(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_emoji_presentation(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_extender(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_extended_pictographic(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_graph(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_grapheme_base(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_grapheme_extend(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_grapheme_link(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_hex_digit(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_hyphen(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_id_continue(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_ideographic(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_id_start(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_ids_binary_operator(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_ids_trinary_operator(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_join_control(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_logical_order_exception(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_lowercase(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_math(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_noncharacter_code_point(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_nfc_inert(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_nfd_inert(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_nfkc_inert(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_nfkd_inert(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_pattern_syntax(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_pattern_white_space(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_prepended_concatenation_mark(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_print(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_quotation_mark(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_radical(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_regional_indicator(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_soft_dotted(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_segment_starter(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_case_sensitive(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_sentence_terminal(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_terminal_punctuation(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_unified_ideograph(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_uppercase(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_variation_selector(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_white_space(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_xdigit(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_xid_continue(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_xid_start(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XCodePointSetData_ICU4XError ICU4XCodePointSetData_load_for_ecma262(const ICU4XDataProvider* provider, const char* property_name_data, size_t property_name_len);
|
||||
void ICU4XCodePointSetData_destroy(ICU4XCodePointSetData* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
#ifndef ICU4XCollator_H
|
||||
#define ICU4XCollator_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCollator ICU4XCollator;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "ICU4XLocale.h"
|
||||
#include "ICU4XCollatorOptionsV1.h"
|
||||
#include "diplomat_result_box_ICU4XCollator_ICU4XError.h"
|
||||
#include "ICU4XOrdering.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCollator_ICU4XError ICU4XCollator_create_v1(const ICU4XDataProvider* provider, const ICU4XLocale* locale, ICU4XCollatorOptionsV1 options);
|
||||
|
||||
ICU4XOrdering ICU4XCollator_compare(const ICU4XCollator* self, const char* left_data, size_t left_len, const char* right_data, size_t right_len);
|
||||
|
||||
ICU4XOrdering ICU4XCollator_compare_valid_utf8(const ICU4XCollator* self, const char* left_data, size_t left_len, const char* right_data, size_t right_len);
|
||||
|
||||
ICU4XOrdering ICU4XCollator_compare_utf16(const ICU4XCollator* self, const uint16_t* left_data, size_t left_len, const uint16_t* right_data, size_t right_len);
|
||||
void ICU4XCollator_destroy(ICU4XCollator* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef ICU4XCollatorAlternateHandling_H
|
||||
#define ICU4XCollatorAlternateHandling_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorAlternateHandling {
|
||||
ICU4XCollatorAlternateHandling_Auto = 0,
|
||||
ICU4XCollatorAlternateHandling_NonIgnorable = 1,
|
||||
ICU4XCollatorAlternateHandling_Shifted = 2,
|
||||
} ICU4XCollatorAlternateHandling;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorAlternateHandling_destroy(ICU4XCollatorAlternateHandling* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef ICU4XCollatorBackwardSecondLevel_H
|
||||
#define ICU4XCollatorBackwardSecondLevel_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorBackwardSecondLevel {
|
||||
ICU4XCollatorBackwardSecondLevel_Auto = 0,
|
||||
ICU4XCollatorBackwardSecondLevel_Off = 1,
|
||||
ICU4XCollatorBackwardSecondLevel_On = 2,
|
||||
} ICU4XCollatorBackwardSecondLevel;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorBackwardSecondLevel_destroy(ICU4XCollatorBackwardSecondLevel* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
#ifndef ICU4XCollatorCaseFirst_H
|
||||
#define ICU4XCollatorCaseFirst_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorCaseFirst {
|
||||
ICU4XCollatorCaseFirst_Auto = 0,
|
||||
ICU4XCollatorCaseFirst_Off = 1,
|
||||
ICU4XCollatorCaseFirst_LowerFirst = 2,
|
||||
ICU4XCollatorCaseFirst_UpperFirst = 3,
|
||||
} ICU4XCollatorCaseFirst;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorCaseFirst_destroy(ICU4XCollatorCaseFirst* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef ICU4XCollatorCaseLevel_H
|
||||
#define ICU4XCollatorCaseLevel_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorCaseLevel {
|
||||
ICU4XCollatorCaseLevel_Auto = 0,
|
||||
ICU4XCollatorCaseLevel_Off = 1,
|
||||
ICU4XCollatorCaseLevel_On = 2,
|
||||
} ICU4XCollatorCaseLevel;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorCaseLevel_destroy(ICU4XCollatorCaseLevel* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
#ifndef ICU4XCollatorMaxVariable_H
|
||||
#define ICU4XCollatorMaxVariable_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorMaxVariable {
|
||||
ICU4XCollatorMaxVariable_Auto = 0,
|
||||
ICU4XCollatorMaxVariable_Space = 1,
|
||||
ICU4XCollatorMaxVariable_Punctuation = 2,
|
||||
ICU4XCollatorMaxVariable_Symbol = 3,
|
||||
ICU4XCollatorMaxVariable_Currency = 4,
|
||||
} ICU4XCollatorMaxVariable;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorMaxVariable_destroy(ICU4XCollatorMaxVariable* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#ifndef ICU4XCollatorNumeric_H
|
||||
#define ICU4XCollatorNumeric_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorNumeric {
|
||||
ICU4XCollatorNumeric_Auto = 0,
|
||||
ICU4XCollatorNumeric_Off = 1,
|
||||
ICU4XCollatorNumeric_On = 2,
|
||||
} ICU4XCollatorNumeric;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorNumeric_destroy(ICU4XCollatorNumeric* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
#ifndef ICU4XCollatorOptionsV1_H
|
||||
#define ICU4XCollatorOptionsV1_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#include "ICU4XCollatorStrength.h"
|
||||
#include "ICU4XCollatorAlternateHandling.h"
|
||||
#include "ICU4XCollatorCaseFirst.h"
|
||||
#include "ICU4XCollatorMaxVariable.h"
|
||||
#include "ICU4XCollatorCaseLevel.h"
|
||||
#include "ICU4XCollatorNumeric.h"
|
||||
#include "ICU4XCollatorBackwardSecondLevel.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCollatorOptionsV1 {
|
||||
ICU4XCollatorStrength strength;
|
||||
ICU4XCollatorAlternateHandling alternate_handling;
|
||||
ICU4XCollatorCaseFirst case_first;
|
||||
ICU4XCollatorMaxVariable max_variable;
|
||||
ICU4XCollatorCaseLevel case_level;
|
||||
ICU4XCollatorNumeric numeric;
|
||||
ICU4XCollatorBackwardSecondLevel backward_second_level;
|
||||
} ICU4XCollatorOptionsV1;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XCollatorStrength.h"
|
||||
#include "ICU4XCollatorAlternateHandling.h"
|
||||
#include "ICU4XCollatorCaseFirst.h"
|
||||
#include "ICU4XCollatorMaxVariable.h"
|
||||
#include "ICU4XCollatorCaseLevel.h"
|
||||
#include "ICU4XCollatorNumeric.h"
|
||||
#include "ICU4XCollatorBackwardSecondLevel.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorOptionsV1_destroy(ICU4XCollatorOptionsV1* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,35 +0,0 @@
|
||||
#ifndef ICU4XCollatorStrength_H
|
||||
#define ICU4XCollatorStrength_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XCollatorStrength {
|
||||
ICU4XCollatorStrength_Auto = 0,
|
||||
ICU4XCollatorStrength_Primary = 1,
|
||||
ICU4XCollatorStrength_Secondary = 2,
|
||||
ICU4XCollatorStrength_Tertiary = 3,
|
||||
ICU4XCollatorStrength_Quaternary = 4,
|
||||
ICU4XCollatorStrength_Identical = 5,
|
||||
} ICU4XCollatorStrength;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XCollatorStrength_destroy(ICU4XCollatorStrength* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
#ifndef ICU4XComposingNormalizer_H
|
||||
#define ICU4XComposingNormalizer_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XComposingNormalizer ICU4XComposingNormalizer;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XComposingNormalizer_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XComposingNormalizer_ICU4XError ICU4XComposingNormalizer_create_nfc(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XComposingNormalizer_ICU4XError ICU4XComposingNormalizer_create_nfkc(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XComposingNormalizer_normalize(const ICU4XComposingNormalizer* self, const char* s_data, size_t s_len, DiplomatWriteable* write);
|
||||
|
||||
bool ICU4XComposingNormalizer_is_normalized(const ICU4XComposingNormalizer* self, const char* s_data, size_t s_len);
|
||||
void ICU4XComposingNormalizer_destroy(ICU4XComposingNormalizer* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,81 +0,0 @@
|
||||
#ifndef ICU4XCustomTimeZone_H
|
||||
#define ICU4XCustomTimeZone_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XCustomTimeZone ICU4XCustomTimeZone;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "diplomat_result_box_ICU4XCustomTimeZone_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#include "diplomat_result_int32_t_ICU4XError.h"
|
||||
#include "diplomat_result_bool_ICU4XError.h"
|
||||
#include "ICU4XMetazoneCalculator.h"
|
||||
#include "ICU4XIsoDateTime.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XCustomTimeZone_ICU4XError ICU4XCustomTimeZone_create_from_string(const char* s_data, size_t s_len);
|
||||
|
||||
ICU4XCustomTimeZone* ICU4XCustomTimeZone_create_empty();
|
||||
|
||||
ICU4XCustomTimeZone* ICU4XCustomTimeZone_create_utc();
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_gmt_offset_seconds(ICU4XCustomTimeZone* self, int32_t offset_seconds);
|
||||
|
||||
void ICU4XCustomTimeZone_clear_gmt_offset(ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_int32_t_ICU4XError ICU4XCustomTimeZone_gmt_offset_seconds(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_is_gmt_offset_positive(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_is_gmt_offset_zero(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_gmt_offset_has_minutes(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_gmt_offset_has_seconds(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_time_zone_id(ICU4XCustomTimeZone* self, const char* id_data, size_t id_len);
|
||||
|
||||
void ICU4XCustomTimeZone_clear_time_zone_id(ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_time_zone_id(const ICU4XCustomTimeZone* self, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_metazone_id(ICU4XCustomTimeZone* self, const char* id_data, size_t id_len);
|
||||
|
||||
void ICU4XCustomTimeZone_clear_metazone_id(ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_metazone_id(const ICU4XCustomTimeZone* self, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_zone_variant(ICU4XCustomTimeZone* self, const char* id_data, size_t id_len);
|
||||
|
||||
void ICU4XCustomTimeZone_clear_zone_variant(ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XCustomTimeZone_zone_variant(const ICU4XCustomTimeZone* self, DiplomatWriteable* write);
|
||||
|
||||
void ICU4XCustomTimeZone_set_standard_time(ICU4XCustomTimeZone* self);
|
||||
|
||||
void ICU4XCustomTimeZone_set_daylight_time(ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_is_standard_time(const ICU4XCustomTimeZone* self);
|
||||
|
||||
diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_is_daylight_time(const ICU4XCustomTimeZone* self);
|
||||
|
||||
void ICU4XCustomTimeZone_maybe_calculate_metazone(ICU4XCustomTimeZone* self, const ICU4XMetazoneCalculator* metazone_calculator, const ICU4XIsoDateTime* local_datetime);
|
||||
void ICU4XCustomTimeZone_destroy(ICU4XCustomTimeZone* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
#ifndef ICU4XDataProvider_H
|
||||
#define ICU4XDataProvider_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDataProvider ICU4XDataProvider;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "diplomat_result_box_ICU4XDataProvider_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#include "ICU4XLocaleFallbacker.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDataProvider_ICU4XError ICU4XDataProvider_create_fs(const char* path_data, size_t path_len);
|
||||
|
||||
ICU4XDataProvider* ICU4XDataProvider_create_test();
|
||||
|
||||
diplomat_result_box_ICU4XDataProvider_ICU4XError ICU4XDataProvider_create_from_byte_slice(const uint8_t* blob_data, size_t blob_len);
|
||||
|
||||
ICU4XDataProvider* ICU4XDataProvider_create_empty();
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDataProvider_fork_by_key(ICU4XDataProvider* self, ICU4XDataProvider* other);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDataProvider_fork_by_locale(ICU4XDataProvider* self, ICU4XDataProvider* other);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDataProvider_enable_locale_fallback(ICU4XDataProvider* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDataProvider_enable_locale_fallback_with(ICU4XDataProvider* self, const ICU4XLocaleFallbacker* fallbacker);
|
||||
void ICU4XDataProvider_destroy(ICU4XDataProvider* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
#ifndef ICU4XDataStruct_H
|
||||
#define ICU4XDataStruct_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDataStruct ICU4XDataStruct;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "diplomat_result_box_ICU4XDataStruct_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDataStruct_ICU4XError ICU4XDataStruct_create_decimal_symbols_v1(const char* plus_sign_prefix_data, size_t plus_sign_prefix_len, const char* plus_sign_suffix_data, size_t plus_sign_suffix_len, const char* minus_sign_prefix_data, size_t minus_sign_prefix_len, const char* minus_sign_suffix_data, size_t minus_sign_suffix_len, const char* decimal_separator_data, size_t decimal_separator_len, const char* grouping_separator_data, size_t grouping_separator_len, uint8_t primary_group_size, uint8_t secondary_group_size, uint8_t min_group_size, const char32_t* digits_data, size_t digits_len);
|
||||
void ICU4XDataStruct_destroy(ICU4XDataStruct* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
66
third_party/rust/icu_capi/c/include/ICU4XDate.h
vendored
66
third_party/rust/icu_capi/c/include/ICU4XDate.h
vendored
@ -1,66 +0,0 @@
|
||||
#ifndef ICU4XDate_H
|
||||
#define ICU4XDate_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDate ICU4XDate;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XCalendar.h"
|
||||
#include "diplomat_result_box_ICU4XDate_ICU4XError.h"
|
||||
#include "ICU4XIsoDate.h"
|
||||
#include "ICU4XIsoWeekday.h"
|
||||
#include "ICU4XWeekCalculator.h"
|
||||
#include "diplomat_result_ICU4XWeekOf_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDate_ICU4XError ICU4XDate_create_from_iso_in_calendar(int32_t year, uint8_t month, uint8_t day, const ICU4XCalendar* calendar);
|
||||
|
||||
diplomat_result_box_ICU4XDate_ICU4XError ICU4XDate_create_from_codes_in_calendar(const char* era_code_data, size_t era_code_len, int32_t year, const char* month_code_data, size_t month_code_len, uint8_t day, const ICU4XCalendar* calendar);
|
||||
|
||||
ICU4XDate* ICU4XDate_to_calendar(const ICU4XDate* self, const ICU4XCalendar* calendar);
|
||||
|
||||
ICU4XIsoDate* ICU4XDate_to_iso(const ICU4XDate* self);
|
||||
|
||||
uint32_t ICU4XDate_day_of_month(const ICU4XDate* self);
|
||||
|
||||
ICU4XIsoWeekday ICU4XDate_day_of_week(const ICU4XDate* self);
|
||||
|
||||
uint32_t ICU4XDate_week_of_month(const ICU4XDate* self, ICU4XIsoWeekday first_weekday);
|
||||
|
||||
diplomat_result_ICU4XWeekOf_ICU4XError ICU4XDate_week_of_year(const ICU4XDate* self, const ICU4XWeekCalculator* calculator);
|
||||
|
||||
uint32_t ICU4XDate_ordinal_month(const ICU4XDate* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDate_month_code(const ICU4XDate* self, DiplomatWriteable* write);
|
||||
|
||||
int32_t ICU4XDate_year_in_era(const ICU4XDate* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDate_era(const ICU4XDate* self, DiplomatWriteable* write);
|
||||
|
||||
uint8_t ICU4XDate_months_in_year(const ICU4XDate* self);
|
||||
|
||||
uint8_t ICU4XDate_days_in_month(const ICU4XDate* self);
|
||||
|
||||
uint32_t ICU4XDate_days_in_year(const ICU4XDate* self);
|
||||
|
||||
ICU4XCalendar* ICU4XDate_calendar(const ICU4XDate* self);
|
||||
void ICU4XDate_destroy(ICU4XDate* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,46 +0,0 @@
|
||||
#ifndef ICU4XDateFormatter_H
|
||||
#define ICU4XDateFormatter_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDateFormatter ICU4XDateFormatter;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "ICU4XLocale.h"
|
||||
#include "ICU4XDateLength.h"
|
||||
#include "diplomat_result_box_ICU4XDateFormatter_ICU4XError.h"
|
||||
#include "ICU4XDate.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#include "ICU4XIsoDate.h"
|
||||
#include "ICU4XDateTime.h"
|
||||
#include "ICU4XIsoDateTime.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDateFormatter_ICU4XError ICU4XDateFormatter_create_with_length(const ICU4XDataProvider* provider, const ICU4XLocale* locale, ICU4XDateLength date_length);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateFormatter_format_date(const ICU4XDateFormatter* self, const ICU4XDate* value, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateFormatter_format_iso_date(const ICU4XDateFormatter* self, const ICU4XIsoDate* value, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateFormatter_format_datetime(const ICU4XDateFormatter* self, const ICU4XDateTime* value, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateFormatter_format_iso_datetime(const ICU4XDateFormatter* self, const ICU4XIsoDateTime* value, DiplomatWriteable* write);
|
||||
void ICU4XDateFormatter_destroy(ICU4XDateFormatter* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
#ifndef ICU4XDateLength_H
|
||||
#define ICU4XDateLength_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef enum ICU4XDateLength {
|
||||
ICU4XDateLength_Full = 0,
|
||||
ICU4XDateLength_Long = 1,
|
||||
ICU4XDateLength_Medium = 2,
|
||||
ICU4XDateLength_Short = 3,
|
||||
} ICU4XDateLength;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XDateLength_destroy(ICU4XDateLength* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,82 +0,0 @@
|
||||
#ifndef ICU4XDateTime_H
|
||||
#define ICU4XDateTime_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDateTime ICU4XDateTime;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XCalendar.h"
|
||||
#include "diplomat_result_box_ICU4XDateTime_ICU4XError.h"
|
||||
#include "ICU4XDate.h"
|
||||
#include "ICU4XTime.h"
|
||||
#include "ICU4XIsoDateTime.h"
|
||||
#include "ICU4XIsoWeekday.h"
|
||||
#include "ICU4XWeekCalculator.h"
|
||||
#include "diplomat_result_ICU4XWeekOf_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDateTime_ICU4XError ICU4XDateTime_create_from_iso_in_calendar(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanosecond, const ICU4XCalendar* calendar);
|
||||
|
||||
diplomat_result_box_ICU4XDateTime_ICU4XError ICU4XDateTime_create_from_codes_in_calendar(const char* era_code_data, size_t era_code_len, int32_t year, const char* month_code_data, size_t month_code_len, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanosecond, const ICU4XCalendar* calendar);
|
||||
|
||||
ICU4XDateTime* ICU4XDateTime_create_from_date_and_time(const ICU4XDate* date, const ICU4XTime* time);
|
||||
|
||||
ICU4XDate* ICU4XDateTime_date(const ICU4XDateTime* self);
|
||||
|
||||
ICU4XTime* ICU4XDateTime_time(const ICU4XDateTime* self);
|
||||
|
||||
ICU4XIsoDateTime* ICU4XDateTime_to_iso(const ICU4XDateTime* self);
|
||||
|
||||
ICU4XDateTime* ICU4XDateTime_to_calendar(const ICU4XDateTime* self, const ICU4XCalendar* calendar);
|
||||
|
||||
uint8_t ICU4XDateTime_hour(const ICU4XDateTime* self);
|
||||
|
||||
uint8_t ICU4XDateTime_minute(const ICU4XDateTime* self);
|
||||
|
||||
uint8_t ICU4XDateTime_second(const ICU4XDateTime* self);
|
||||
|
||||
uint32_t ICU4XDateTime_nanosecond(const ICU4XDateTime* self);
|
||||
|
||||
uint32_t ICU4XDateTime_day_of_month(const ICU4XDateTime* self);
|
||||
|
||||
ICU4XIsoWeekday ICU4XDateTime_day_of_week(const ICU4XDateTime* self);
|
||||
|
||||
uint32_t ICU4XDateTime_week_of_month(const ICU4XDateTime* self, ICU4XIsoWeekday first_weekday);
|
||||
|
||||
diplomat_result_ICU4XWeekOf_ICU4XError ICU4XDateTime_week_of_year(const ICU4XDateTime* self, const ICU4XWeekCalculator* calculator);
|
||||
|
||||
uint32_t ICU4XDateTime_ordinal_month(const ICU4XDateTime* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateTime_month_code(const ICU4XDateTime* self, DiplomatWriteable* write);
|
||||
|
||||
int32_t ICU4XDateTime_year_in_era(const ICU4XDateTime* self);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateTime_era(const ICU4XDateTime* self, DiplomatWriteable* write);
|
||||
|
||||
uint8_t ICU4XDateTime_months_in_year(const ICU4XDateTime* self);
|
||||
|
||||
uint8_t ICU4XDateTime_days_in_month(const ICU4XDateTime* self);
|
||||
|
||||
uint32_t ICU4XDateTime_days_in_year(const ICU4XDateTime* self);
|
||||
|
||||
ICU4XCalendar* ICU4XDateTime_calendar(const ICU4XDateTime* self);
|
||||
void ICU4XDateTime_destroy(ICU4XDateTime* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,41 +0,0 @@
|
||||
#ifndef ICU4XDateTimeFormatter_H
|
||||
#define ICU4XDateTimeFormatter_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDateTimeFormatter ICU4XDateTimeFormatter;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "ICU4XLocale.h"
|
||||
#include "ICU4XDateLength.h"
|
||||
#include "ICU4XTimeLength.h"
|
||||
#include "diplomat_result_box_ICU4XDateTimeFormatter_ICU4XError.h"
|
||||
#include "ICU4XDateTime.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#include "ICU4XIsoDateTime.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDateTimeFormatter_ICU4XError ICU4XDateTimeFormatter_create_with_lengths(const ICU4XDataProvider* provider, const ICU4XLocale* locale, ICU4XDateLength date_length, ICU4XTimeLength time_length);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateTimeFormatter_format_datetime(const ICU4XDateTimeFormatter* self, const ICU4XDateTime* value, DiplomatWriteable* write);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDateTimeFormatter_format_iso_datetime(const ICU4XDateTimeFormatter* self, const ICU4XIsoDateTime* value, DiplomatWriteable* write);
|
||||
void ICU4XDateTimeFormatter_destroy(ICU4XDateTimeFormatter* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
#ifndef ICU4XDecomposed_H
|
||||
#define ICU4XDecomposed_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDecomposed {
|
||||
char32_t first;
|
||||
char32_t second;
|
||||
} ICU4XDecomposed;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ICU4XDecomposed_destroy(ICU4XDecomposed* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
#ifndef ICU4XDecomposingNormalizer_H
|
||||
#define ICU4XDecomposingNormalizer_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "diplomat_runtime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
#endif
|
||||
|
||||
typedef struct ICU4XDecomposingNormalizer ICU4XDecomposingNormalizer;
|
||||
#ifdef __cplusplus
|
||||
} // namespace capi
|
||||
#endif
|
||||
#include "ICU4XDataProvider.h"
|
||||
#include "diplomat_result_box_ICU4XDecomposingNormalizer_ICU4XError.h"
|
||||
#include "diplomat_result_void_ICU4XError.h"
|
||||
#ifdef __cplusplus
|
||||
namespace capi {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
diplomat_result_box_ICU4XDecomposingNormalizer_ICU4XError ICU4XDecomposingNormalizer_create_nfd(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_box_ICU4XDecomposingNormalizer_ICU4XError ICU4XDecomposingNormalizer_create_nfkd(const ICU4XDataProvider* provider);
|
||||
|
||||
diplomat_result_void_ICU4XError ICU4XDecomposingNormalizer_normalize(const ICU4XDecomposingNormalizer* self, const char* s_data, size_t s_len, DiplomatWriteable* write);
|
||||
|
||||
bool ICU4XDecomposingNormalizer_is_normalized(const ICU4XDecomposingNormalizer* self, const char* s_data, size_t s_len);
|
||||
void ICU4XDecomposingNormalizer_destroy(ICU4XDecomposingNormalizer* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace capi
|
||||
#endif
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user