summaryrefslogtreecommitdiffstats
path: root/third_party/rust/phf_codegen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/phf_codegen
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/phf_codegen')
-rw-r--r--third_party/rust/phf_codegen/.cargo-checksum.json1
-rw-r--r--third_party/rust/phf_codegen/CHANGELOG.md219
-rw-r--r--third_party/rust/phf_codegen/Cargo.toml29
-rw-r--r--third_party/rust/phf_codegen/LICENSE20
-rw-r--r--third_party/rust/phf_codegen/README.md127
-rw-r--r--third_party/rust/phf_codegen/src/lib.rs502
6 files changed, 898 insertions, 0 deletions
diff --git a/third_party/rust/phf_codegen/.cargo-checksum.json b/third_party/rust/phf_codegen/.cargo-checksum.json
new file mode 100644
index 0000000000..3d5dfd15c8
--- /dev/null
+++ b/third_party/rust/phf_codegen/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"5d36f47029fce4eefe7a274bc4aa80de163ed9335746394e89106731b187e019","Cargo.toml":"bd4600efa839936a8173610bd446392b73dfc7a0056f764db8f3e6cee83ab3ed","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"cc039ae7021814495ef56d3680fa78f3d0d671c86223b35cfb6d50021c40b64e","src/lib.rs":"18fc8047ee8e989520e83f5162721413c6e708bc75473b514bbd1159137fcba2"},"package":"e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"} \ No newline at end of file
diff --git a/third_party/rust/phf_codegen/CHANGELOG.md b/third_party/rust/phf_codegen/CHANGELOG.md
new file mode 100644
index 0000000000..68f7fdb3c2
--- /dev/null
+++ b/third_party/rust/phf_codegen/CHANGELOG.md
@@ -0,0 +1,219 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## Unreleased
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 4 commits contributed to the release over the course of 269 calendar days.
+ - 320 days passed between releases.
+ - 0 commits were understood as [conventional](https://www.conventionalcommits.org).
+ - 0 issues like '(#ID)' were seen in commit messages
+
+### Commit Details
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **Uncategorized**
+ - Merge pull request #274 from ankane/license-files ([`21baa73`](https://github.com/rust-phf/rust-phf/commit/21baa73941a0694ec48f437c0c0a6abfcc2f32d2))
+ - Include license files in crates ([`1229b2f`](https://github.com/rust-phf/rust-phf/commit/1229b2faa6b97542ab4850a1723b1723dea92814))
+ - Merge pull request #269 from JohnTitor/clarify-build-deps ([`3bc663e`](https://github.com/rust-phf/rust-phf/commit/3bc663eb82686caeab4f49848d867ce87d313765))
+ - Mention build-dependencies on phf_codegen ([`307ef77`](https://github.com/rust-phf/rust-phf/commit/307ef778fb3aa414b70b2d9584c71ee1a361836e))
+</details>
+
+## 0.11.1 (2022-08-08)
+
+<csr-id-f04e8def1d3ca69dadada2b37297a1b92cfe5440/>
+
+### Other
+
+ - <csr-id-f04e8def1d3ca69dadada2b37297a1b92cfe5440/> add example using byte strings
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 163 commits contributed to the release over the course of 2723 calendar days.
+ - 1 commit was understood as [conventional](https://www.conventionalcommits.org).
+ - 0 issues like '(#ID)' were seen in commit messages
+
+### Commit Details
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **Uncategorized**
+ - Release phf_shared v0.11.1, phf_generator v0.11.1, phf_macros v0.11.1, phf v0.11.1, phf_codegen v0.11.1 ([`3897b21`](https://github.com/rust-phf/rust-phf/commit/3897b21c6d38e5adcaf9110b4bb33c19f6b41977))
+ - Merge pull request #264 from rust-phf/tweak-changelog ([`97f997d`](https://github.com/rust-phf/rust-phf/commit/97f997d2be827ca636a29046c78e2c09c5c62650))
+ - Replace handmade changelog with generated one by `cargo-smart-release` ([`cb84cf6`](https://github.com/rust-phf/rust-phf/commit/cb84cf6636ab52823c53e70d6abeac8f648a3482))
+ - Merge pull request #260 from JohnTitor/fix-repo-link ([`1407ebe`](https://github.com/rust-phf/rust-phf/commit/1407ebe536b39611db92d765ddec4de0e6c8a16e))
+ - Add category to crates ([`32a72c3`](https://github.com/rust-phf/rust-phf/commit/32a72c3859997fd6b590e9ec092ae789d2acdf55))
+ - Update repository links on Cargo.toml ([`1af3b0f`](https://github.com/rust-phf/rust-phf/commit/1af3b0fe1f8fdcae7ccc1bc8d51de309fb16a6bf))
+ - Merge pull request #258 from JohnTitor/release-0.11.0 ([`c0b9ef9`](https://github.com/rust-phf/rust-phf/commit/c0b9ef98e798f807f94544aeb0fff429ef280efc))
+ - Release 0.11.0 ([`d2efdc0`](https://github.com/rust-phf/rust-phf/commit/d2efdc08a7eb1d0d6c414b7b2ac41ce1fe1f9a43))
+ - Merge pull request #257 from JohnTitor/edition-2021 ([`36ec885`](https://github.com/rust-phf/rust-phf/commit/36ec8854a9da4f295618e98d94aaf7150df2173e))
+ - Make crates edition 2021 ([`b9d25da`](https://github.com/rust-phf/rust-phf/commit/b9d25da58b912d9927fbc41901631cd77836462b))
+ - Merge pull request #252 from JohnTitor/clippy-fixes ([`22570b8`](https://github.com/rust-phf/rust-phf/commit/22570b89476248d22c9d77f315fd98e048c49700))
+ - Fix some Clippy warnings ([`71fd47c`](https://github.com/rust-phf/rust-phf/commit/71fd47ca27a8b1fe24b2eec75efd17ddfe11835f))
+ - Merge pull request #251 from JohnTitor/weak-deps ([`2e1167c`](https://github.com/rust-phf/rust-phf/commit/2e1167c2046cd20aed1a906b4e23b40303cf0c00))
+ - Make "unicase + macros" features work ([`11bb242`](https://github.com/rust-phf/rust-phf/commit/11bb2426f0237b1ecea8c8038630b1231ede4871))
+ - Merge pull request #245 from JohnTitor/phf-0.10.1 ([`bed0153`](https://github.com/rust-phf/rust-phf/commit/bed01538ae576876f11189d541875d228acef9e8))
+ - Prepare 0.10.1 release ([`4cc8344`](https://github.com/rust-phf/rust-phf/commit/4cc8344fad640ed71d75f557ce1a3b6eded321c3))
+ - Merge pull request #241 from JohnTitor/extract-macro-tests ([`7b0a313`](https://github.com/rust-phf/rust-phf/commit/7b0a3130a55176d2570300f92cb7ddca6c23da83))
+ - Extract `phf_macros` tests as a separated crate ([`8cf694d`](https://github.com/rust-phf/rust-phf/commit/8cf694d76e0991b4e24ecdc5d2a88bb74713d9cd))
+ - Merge pull request #240 from JohnTitor/docs-update ([`da98b9e`](https://github.com/rust-phf/rust-phf/commit/da98b9e80fdb22cd6d48a4a42489840afe603756))
+ - Refine doc comments ([`d8cfc43`](https://github.com/rust-phf/rust-phf/commit/d8cfc436059a1c2c3ede1afb0f9ec2333c046fc6))
+ - Merge pull request #234 from JohnTitor/fix-ci ([`eba4cc2`](https://github.com/rust-phf/rust-phf/commit/eba4cc28d92c1db95cc430985a0fbc9ca63d1307))
+ - Fix CI failure ([`d9b5ff2`](https://github.com/rust-phf/rust-phf/commit/d9b5ff23367d2bbcc385ff8243c7d972f45d459c))
+ - Merge pull request #230 from JohnTitor/release-0.10 ([`3ea14b2`](https://github.com/rust-phf/rust-phf/commit/3ea14b2166553ad6e7b9afe7244144f5d661b6c6))
+ - Prepare for release 0.10.0 ([`588ac25`](https://github.com/rust-phf/rust-phf/commit/588ac25dd5c0afccea084e6f94867328a6a30454))
+ - Merge pull request #228 from JohnTitor/release-0.9.1 ([`d527f9d`](https://github.com/rust-phf/rust-phf/commit/d527f9d016adafe7d2930e37710291030b432838))
+ - Prepare for v0.9.1 ([`9b71978`](https://github.com/rust-phf/rust-phf/commit/9b719789149ef195ef5eba093b7e73255fbef8dc))
+ - Merge pull request #224 from bhgomes/const-fns ([`65deaf7`](https://github.com/rust-phf/rust-phf/commit/65deaf745b5175b6b8e645b6c66e53fc55bb3a85))
+ - Remove Slice type and fix some docs ([`99d3533`](https://github.com/rust-phf/rust-phf/commit/99d353390f8124a283da9202fd4d163e68bc1949))
+ - Merge pull request #223 from JohnTitor/minor-cleanup ([`c746106`](https://github.com/rust-phf/rust-phf/commit/c746106ad05917ad62f244504727b07e07c3e075))
+ - Minor cleanups ([`8868d08`](https://github.com/rust-phf/rust-phf/commit/8868d088e2fed36fcd7741e9a1c5bf68bef4f46e))
+ - Merge pull request #219 from JohnTitor/release-0.9.0 ([`307969f`](https://github.com/rust-phf/rust-phf/commit/307969ff3bb8cae320e648890a9525920035944b))
+ - Prepare 0.9.0 release ([`2ca46c4`](https://github.com/rust-phf/rust-phf/commit/2ca46c4f9c9083c128fcc6add33dc5986638940f))
+ - Cleanup cargo metadata ([`a9e4b0a`](https://github.com/rust-phf/rust-phf/commit/a9e4b0a1e84825004fa66e938b870f83d3147d0d))
+ - Merge pull request #218 from JohnTitor/cleanup ([`76f9072`](https://github.com/rust-phf/rust-phf/commit/76f907239af9b0cca7dac4e6d702cedc72f6f371))
+ - Run rustfmt ([`dd86c6c`](https://github.com/rust-phf/rust-phf/commit/dd86c6c103f25021b52144085b8fab0a94582bef))
+ - Fix some clippy warnings ([`9adc370`](https://github.com/rust-phf/rust-phf/commit/9adc370ead7fbcc36cd0c74f495ab7631e0c9754))
+ - Cleanup docs ([`ddecc3a`](https://github.com/rust-phf/rust-phf/commit/ddecc3aa97aec6d9e9d6e59c57bc598d476335c1))
+ - Merge pull request #197 from benesch/uncased ([`8b44f0c`](https://github.com/rust-phf/rust-phf/commit/8b44f0c4caf1a431426ff8dbae68f0693d6cef63))
+ - Add support for uncased ([`2a6087f`](https://github.com/rust-phf/rust-phf/commit/2a6087fcaf99b445ff6013f693f7c4fe5d6f7387))
+ - Merge pull request #174 from abonander/169-drop-borrow ([`3c087d4`](https://github.com/rust-phf/rust-phf/commit/3c087d4782be496e7955d2b51d5883c4ce64ccd3))
+ - Replace uses of `std::borrow::Borrow` with new `PhfBorrow` trait ([`b2f3a9c`](https://github.com/rust-phf/rust-phf/commit/b2f3a9c6a95ebabc2b0ae7ed1ec3ee7d72418e85))
+ - Merge pull request #205 from skyfloogle/ordered-stuff ([`9ae1678`](https://github.com/rust-phf/rust-phf/commit/9ae1678f2507d6d26a1b780385a2e17bdfbb0b5c))
+ - Add back ordered_map, ordered_set ([`0ab0108`](https://github.com/rust-phf/rust-phf/commit/0ab01081e4bd8f40bc18ab554c95f217220228d5))
+ - Merge pull request #208 from JohnTitor/simplify-workspace ([`a47ac36`](https://github.com/rust-phf/rust-phf/commit/a47ac36b16dd8798659be3e24f74051cd1ed760d))
+ - Use `[patch.crates-io]` section instead of path key ([`f47515b`](https://github.com/rust-phf/rust-phf/commit/f47515bce5c433214dbecee262a7a6f14e6a74d4))
+ - Merge pull request #180 from abonander/master ([`81c7cc5`](https://github.com/rust-phf/rust-phf/commit/81c7cc5b48649108428671d3b8ad151f6fbdb359))
+ - Release v0.8.0 ([`4060288`](https://github.com/rust-phf/rust-phf/commit/4060288dc2c1ebe3b0630e4016ed51935bb0c863))
+ - Merge pull request #171 from abonander/170-removals ([`0d00821`](https://github.com/rust-phf/rust-phf/commit/0d0082178568036736bb6d51cb91f95ca5a616c3))
+ - Remove ordered_map, ordered_set, phf_builder ([`8ae2bb8`](https://github.com/rust-phf/rust-phf/commit/8ae2bb886841a69a4fc482f439e2374f2373ab15))
+ - Merge pull request #165 from abonander/151-byte-string-keys ([`c5959b4`](https://github.com/rust-phf/rust-phf/commit/c5959b4f2c058134bf356268492845cf9e23ca95))
+ - Fix intra-module links ([`774c527`](https://github.com/rust-phf/rust-phf/commit/774c527473b4327c41ca32d3db9e163273ab4ff7))
+ - Remove links to `phf` types since that crate is not linked ([`e7830f9`](https://github.com/rust-phf/rust-phf/commit/e7830f910dcc0996476d085013ac590fad6ffb40))
+ - Add example using byte strings ([`f04e8de`](https://github.com/rust-phf/rust-phf/commit/f04e8def1d3ca69dadada2b37297a1b92cfe5440))
+ - Merge pull request #161 from abonander/display-builders ([`171f7ed`](https://github.com/rust-phf/rust-phf/commit/171f7edccb71766e9381600108a0d996513ec7ea))
+ - Create `Display` adapters for `phf_codegen` builders ([`93aa7ae`](https://github.com/rust-phf/rust-phf/commit/93aa7ae1de87345ea19f38e747283bc712384650))
+ - Merge pull request #164 from abonander/perf-improvements ([`70129c6`](https://github.com/rust-phf/rust-phf/commit/70129c6fbcdf428ce9f1014eea935301ac70e410))
+ - Use two separate hashes and full 32-bit displacements ([`9b70bd9`](https://github.com/rust-phf/rust-phf/commit/9b70bd94f8b0b74f156e75ccefbd4a4c7ba29728))
+ - Merge pull request #157 from abonander/array-formatting ([`8fc18be`](https://github.com/rust-phf/rust-phf/commit/8fc18be75dd3cb284b0b34b6c9e99c3c92544268))
+ - Add tests for array and byte-slice keys ([`cb7aa0c`](https://github.com/rust-phf/rust-phf/commit/cb7aa0cecf4174be08f6e733334c224050edc2a6))
+ - Merge branch 'master' into patch-1 ([`cd0d7ce`](https://github.com/rust-phf/rust-phf/commit/cd0d7ce1194252dcaca3153988ba2a4effa66b4f))
+ - Merge pull request #152 from abonander/unicase-upgrade ([`27f7c2c`](https://github.com/rust-phf/rust-phf/commit/27f7c2c85efde7aeb3c5409985f2d605aff8e05b))
+ - Convert to 2018 edition ([`9ff66ab`](https://github.com/rust-phf/rust-phf/commit/9ff66ab36a23c7170cc775773f042a06de426c3b))
+ - Upgrade `unicase` ([`4a7f766`](https://github.com/rust-phf/rust-phf/commit/4a7f7667598e7beb4c76c72b2bf2fb6571f6dbd9))
+ - Don't rely on `fmt::Debug` for codegen ([`97405f5`](https://github.com/rust-phf/rust-phf/commit/97405f5be14738dc5d03a8b309297ffa295f4702))
+ - Merge pull request #145 from cetra3/empty_hash ([`2d3176b`](https://github.com/rust-phf/rust-phf/commit/2d3176b384112db5ca3fea08f1973ffc8a7c729b))
+ - Fix & include tests for empty maps ([`83fd51c`](https://github.com/rust-phf/rust-phf/commit/83fd51c3095cbcd22b87c4d26ee22eb27a4e98d0))
+ - Release v0.7.24 ([`1287414`](https://github.com/rust-phf/rust-phf/commit/1287414b1302d2d717c5f4be81accf4c12ccad48))
+ - Release v0.7.23 ([`a050b6f`](https://github.com/rust-phf/rust-phf/commit/a050b6f2a6b825bf0824339266ab9545340420d4))
+ - Release 0.7.22 ([`ab88405`](https://github.com/rust-phf/rust-phf/commit/ab884054fa17eef915db2bdb5259c7aa71fbfea6))
+ - Release v0.7.21 ([`6c7e2d9`](https://github.com/rust-phf/rust-phf/commit/6c7e2d9ce17ff1b87507925bdbe87e6e682ed3e4))
+ - Link to docs.rs ([`61142c5`](https://github.com/rust-phf/rust-phf/commit/61142c5aa168cff1bf53a6961ddc12012b49e1bb))
+ - Dependency cleanup ([`f106aa6`](https://github.com/rust-phf/rust-phf/commit/f106aa66d85abfba3d627d12fd46a9b080c83e95))
+ - Release v0.7.20 ([`f631f50`](https://github.com/rust-phf/rust-phf/commit/f631f50abfaf6ea3d6fc8caaada47975b6df3a62))
+ - Merge branch 'release' ([`ea7e256`](https://github.com/rust-phf/rust-phf/commit/ea7e2562706663632a0af65ae9fa94e5cf78c4ea))
+ - Merge branch 'release-v0.7.19' into release ([`81a4806`](https://github.com/rust-phf/rust-phf/commit/81a4806b05f14fb49aa972de27a42926a542ec44))
+ - Release v0.7.19 ([`0a98dd1`](https://github.com/rust-phf/rust-phf/commit/0a98dd1865d12a3fa4cc27bdb38fa1e7374940d9))
+ - Merge branch 'release' ([`ecab54b`](https://github.com/rust-phf/rust-phf/commit/ecab54b8a028c88938f220dbb0a684e017bab62f))
+ - Merge branch 'release-v0.7.18' into release ([`dfa970b`](https://github.com/rust-phf/rust-phf/commit/dfa970b229cc32cfb2da1692aa94ad8a266e704a))
+ - Release v0.7.18 ([`3f71765`](https://github.com/rust-phf/rust-phf/commit/3f717650f4331f5dbb9d7a3f878228fcf1138729))
+ - Merge branch 'release' ([`5f08563`](https://github.com/rust-phf/rust-phf/commit/5f0856327731107d9fada1b0318f6f15f32957c2))
+ - Merge branch 'release-v0.7.17' into release ([`e073dd2`](https://github.com/rust-phf/rust-phf/commit/e073dd262d1b4c95234222ee5048fc883b9c7301))
+ - Release v0.7.17 ([`21ecf72`](https://github.com/rust-phf/rust-phf/commit/21ecf72101715e4754db95a64ecd7de5a37b7f14))
+ - Merge branch 'release' ([`839f06d`](https://github.com/rust-phf/rust-phf/commit/839f06d5a10c1300353b8f3c972990624695b668))
+ - Merge branch 'release-v0.7.16' into release ([`6f5575c`](https://github.com/rust-phf/rust-phf/commit/6f5575c9b12d3619ea17c0825a613fcac12820f4))
+ - Release v0.7.16 ([`8bf29c1`](https://github.com/rust-phf/rust-phf/commit/8bf29c10a878c83d73cc40385f0e96cb9cc95afa))
+ - Merge branch 'release' ([`b4ec398`](https://github.com/rust-phf/rust-phf/commit/b4ec398f415e5cac2cd4d794b1889788e644447f))
+ - Merge branch 'release-v0.7.15' into release ([`6bbc9e2`](https://github.com/rust-phf/rust-phf/commit/6bbc9e249b9a84e2019432b7d3b178851d2d776e))
+ - Release v0.7.15 ([`20f896e`](https://github.com/rust-phf/rust-phf/commit/20f896e6975cabb9cf9883b08eaa5b3da8597f11))
+ - Merge pull request #83 from aidanhs/aphs-set-phf-path-2 ([`66ead77`](https://github.com/rust-phf/rust-phf/commit/66ead7737f446201eb8539308972c8e7d68b4866))
+ - Add overlooked phf path overrides ([`da5f9be`](https://github.com/rust-phf/rust-phf/commit/da5f9bea6d964f48453116090085386e2fd1bab3))
+ - Merge pull request #81 from aidanhs/aphs-set-phf-path ([`c59f70e`](https://github.com/rust-phf/rust-phf/commit/c59f70eac26b7c2e1ca376408a8d142afde4217c))
+ - Allow specifying a module path to the phf crate for codegen ([`4a7999e`](https://github.com/rust-phf/rust-phf/commit/4a7999e861bd32ee97a7d35e0a392bdd2ca1b0b7))
+ - Merge branch 'release' ([`7c692d4`](https://github.com/rust-phf/rust-phf/commit/7c692d42970bf6cb2540f6b2d3c88d63b3fd1f7a))
+ - Merge branch 'release-v0.7.14' into release ([`ea8dd65`](https://github.com/rust-phf/rust-phf/commit/ea8dd652c292746a20bf3a680e9f925f6f0530b1))
+ - Release v0.7.14 ([`fee66fc`](https://github.com/rust-phf/rust-phf/commit/fee66fc20e33f2b119f830a8926f3b6e52abcf09))
+ - Merge pull request #82 from Ryman/unicase ([`909fac5`](https://github.com/rust-phf/rust-phf/commit/909fac5d4414a7d366432de078bcc6f78a25c230))
+ - Add an impl of PhfHash for UniCase ([`d761144`](https://github.com/rust-phf/rust-phf/commit/d761144daf92ce6aed83165aa840a1ae72bd0bb2))
+ - Introduce a Slice abstraction for buffers ([`0cc3844`](https://github.com/rust-phf/rust-phf/commit/0cc38449c21f29bd9348e28c5719d650e16159cf))
+ - Merge branch 'release' ([`d9351e1`](https://github.com/rust-phf/rust-phf/commit/d9351e1488bd42d1a4453e4a465177fb1c781fdc))
+ - Merge branch 'release-v0.7.13' into release ([`b582e4e`](https://github.com/rust-phf/rust-phf/commit/b582e4ecec23be992ba915fc7873c0d5598f388a))
+ - Release v0.7.13 ([`4769a6d`](https://github.com/rust-phf/rust-phf/commit/4769a6d2ce1d392da06e4b3cb833a1cdccb1f1aa))
+ - Merge branch 'release' ([`5659a9d`](https://github.com/rust-phf/rust-phf/commit/5659a9db39bc5ee2179b264fce4cba4384d6d025))
+ - Merge branch 'release-v0.7.12' into release ([`2f0a5de`](https://github.com/rust-phf/rust-phf/commit/2f0a5de9f01d9d22c774d8d85daec2a047a462e8))
+ - Release v0.7.12 ([`9b75ee5`](https://github.com/rust-phf/rust-phf/commit/9b75ee5ed14060c45a5785fba0387be09e698624))
+ - Merge branch 'release' ([`87ffab8`](https://github.com/rust-phf/rust-phf/commit/87ffab863aaeefb5ac2164da62f0407122d8057e))
+ - Merge branch 'release-v0.7.11' into release ([`7260d04`](https://github.com/rust-phf/rust-phf/commit/7260d04413349bacab484afb74f9a496335278e1))
+ - Release v0.7.11 ([`a004227`](https://github.com/rust-phf/rust-phf/commit/a0042277b181ec95fcbf29751b9a453f4f962ebb))
+ - Merge branch 'release' ([`1579bec`](https://github.com/rust-phf/rust-phf/commit/1579bec1448c7b833f5965fe39d4ef2df66c982c))
+ - Merge branch 'release-v0.7.10' into release ([`25cea13`](https://github.com/rust-phf/rust-phf/commit/25cea133fb4eec938bdfa74f04adbc8d94e30d4e))
+ - Release v0.7.10 ([`c43154b`](https://github.com/rust-phf/rust-phf/commit/c43154b2661dc09620a7879c16f37b47d6ec03ae))
+ - Merge branch 'release' ([`2c67ce5`](https://github.com/rust-phf/rust-phf/commit/2c67ce5a4129cd543178bf015f021a3bb83b6895))
+ - Merge branch 'release-v0.7.9' into release ([`87206e1`](https://github.com/rust-phf/rust-phf/commit/87206e1c7b8d4089370dc168402ded0c0700a447))
+ - Release v0.7.9 ([`b7d29df`](https://github.com/rust-phf/rust-phf/commit/b7d29dfe0df288b2da74de195f764eace1c8e443))
+ - Merge branch 'release' ([`cd33902`](https://github.com/rust-phf/rust-phf/commit/cd339023e90ac1ce6971fa81badea65fb1f2b086))
+ - Merge branch 'release-v0.7.8' into release ([`8bc23a0`](https://github.com/rust-phf/rust-phf/commit/8bc23a023908a038d668b6f7d8e94ee416995285))
+ - Release v0.7.8 ([`aad0b9b`](https://github.com/rust-phf/rust-phf/commit/aad0b9b658fb970e3df60b066961aafca1a17c44))
+ - Merge branch 'release' ([`dccff69`](https://github.com/rust-phf/rust-phf/commit/dccff69384729e3d4972174ce62d8f9db9429485))
+ - Merge branch 'release-v0.7.7' into release ([`2d988b7`](https://github.com/rust-phf/rust-phf/commit/2d988b7dfb04d949246adc047f6b195263612246))
+ - Release v0.7.7 ([`c9e7a93`](https://github.com/rust-phf/rust-phf/commit/c9e7a93f4d6f85a72651aba6187e4c956d8c1167))
+ - Run through rustfmt ([`58e2223`](https://github.com/rust-phf/rust-phf/commit/58e222380b7fc9609a055cb5a6110ba04e47d677))
+ - Merge branch 'release' ([`776046c`](https://github.com/rust-phf/rust-phf/commit/776046c961456dee9e16a6b6574d336c66e259f8))
+ - Merge branch 'release-v0.7.6' into release ([`2ea7d5c`](https://github.com/rust-phf/rust-phf/commit/2ea7d5cab5e9e54952ca618b43ec3583a33a4847))
+ - Release v0.7.6 ([`5bcd5c9`](https://github.com/rust-phf/rust-phf/commit/5bcd5c95215f5aa29e133cb2912662085a8158f0))
+ - Merge branch 'release' ([`1f770df`](https://github.com/rust-phf/rust-phf/commit/1f770df1290b586a8d641ecb0bbd105080afc0ea))
+ - Merge branch 'release-v0.7.5' into release ([`bb65b8c`](https://github.com/rust-phf/rust-phf/commit/bb65b8cca30ef9d4518e3083558019a972873efa))
+ - Release v0.7.5 ([`fda44f5`](https://github.com/rust-phf/rust-phf/commit/fda44f550401c1bd4aad29bb2c07030b86761028))
+ - Merge pull request #66 from brson/next ([`792b5da`](https://github.com/rust-phf/rust-phf/commit/792b5da77ec99a893e9d1a3ceaeafe5b9f869828))
+ - Work around rust#27438 by adding a call to a non-generic function ([`ddfaebf`](https://github.com/rust-phf/rust-phf/commit/ddfaebfb8f13dbb605ded4510833830fb8bdbf80))
+ - Merge branch 'release' ([`269b5dc`](https://github.com/rust-phf/rust-phf/commit/269b5dc41ebf82f423393d5219e8107e9c911a03))
+ - Merge branch 'release-v0.7.4' into release ([`7c093e8`](https://github.com/rust-phf/rust-phf/commit/7c093e83ffe5192d9cdcd5402b6abb7800ffafb3))
+ - Release v0.7.4 ([`c7c0d3c`](https://github.com/rust-phf/rust-phf/commit/c7c0d3c294126157f0275a05b7c3a65c419234a1))
+ - Merge pull request #61 from SimonSapin/env! ([`d5b3f6d`](https://github.com/rust-phf/rust-phf/commit/d5b3f6dd320cd5a452441693b61a26fd610da6eb))
+ - Don’t use/recommend `env!` in build scripts. ([`b9391ff`](https://github.com/rust-phf/rust-phf/commit/b9391fff4f5cb2c810a01cf8ea42282026ef3617))
+ - Release v0.7.3 ([`77ea239`](https://github.com/rust-phf/rust-phf/commit/77ea23917e908b10c4c5c463671a8409292f8661))
+ - Doc tweak ([`0d23afb`](https://github.com/rust-phf/rust-phf/commit/0d23afb0be5b1dadd21bca8c32e928da4b184f2c))
+ - Warn about rustc stack overflow ([`48759a8`](https://github.com/rust-phf/rust-phf/commit/48759a81c1dc2f07f74c97ce11d732c179caa331))
+ - Fix docs ([`4b94d0f`](https://github.com/rust-phf/rust-phf/commit/4b94d0f2903cff35001e0c63cb62c7258f3ad193))
+ - Fix example ([`0705574`](https://github.com/rust-phf/rust-phf/commit/0705574b530d2e4525df7279846d4891cfbb7d90))
+ - Remove unneeded feature flag ([`efac42a`](https://github.com/rust-phf/rust-phf/commit/efac42abe90b353f372f09775d3ec3d869e18141))
+ - Release v0.7.2 ([`642b69d`](https://github.com/rust-phf/rust-phf/commit/642b69d0100a4ee7ec6e430ef1351bd1f28f9a4a))
+ - Release v0.7.1 ([`9cb9de9`](https://github.com/rust-phf/rust-phf/commit/9cb9de911ad4e16964f0def29780dde1630c3619))
+ - Fix codegen tests ([`4f1cf46`](https://github.com/rust-phf/rust-phf/commit/4f1cf46d9c8b1eddcef856a599c4875a3d3bf0b2))
+ - Release v0.7.0 ([`555a690`](https://github.com/rust-phf/rust-phf/commit/555a690561673597aee068650ac884bbcc2e31cf))
+ - Release v0.6.19 ([`5810d30`](https://github.com/rust-phf/rust-phf/commit/5810d30ef2162f33cfb4da99c65b7344c7f2913b))
+ - Release v0.6.18 ([`36efc72`](https://github.com/rust-phf/rust-phf/commit/36efc721478d097fba1e5458cbdd9f288637abae))
+ - Fix for upstream changes ([`eabadcf`](https://github.com/rust-phf/rust-phf/commit/eabadcf7e8af351ba8f07d86746e35adc8c5812e))
+ - Release v0.6.17 ([`271ccc2`](https://github.com/rust-phf/rust-phf/commit/271ccc27d885363d4d8c549f75624d08c48e56c5))
+ - Release v0.6.15 ([`ede14df`](https://github.com/rust-phf/rust-phf/commit/ede14df1e574674852b09bcafff4ad549ebfd4ae))
+ - Remove pointless dev-dependencies ([`4620622`](https://github.com/rust-phf/rust-phf/commit/4620622da87473c7fee5927196a63e3b03b99bcf))
+ - Release v0.6.14 ([`cf64ebb`](https://github.com/rust-phf/rust-phf/commit/cf64ebb8f769c9f12c9a03d05713dde6b8caf371))
+ - Release v0.6.13 ([`4fdb533`](https://github.com/rust-phf/rust-phf/commit/4fdb5331fd9978ca3e180a06fb2e34627f50fb77))
+ - Fix warnings and use debug builders ([`4d28684`](https://github.com/rust-phf/rust-phf/commit/4d28684b72333e911e23b898b5780947d49822a5))
+ - Remove unused feature ([`efcdc74`](https://github.com/rust-phf/rust-phf/commit/efcdc74300cd26ce5494aaef4cff68ced9a3a4bc))
+ - Release v0.6.12 ([`59ca586`](https://github.com/rust-phf/rust-phf/commit/59ca58637206c9806c13cc24cb35cb7d0ce9d23f))
+ - Fix whitespace in codegen ([`8078e83`](https://github.com/rust-phf/rust-phf/commit/8078e833d04404227909a73139d61baec2b483d3))
+ - Release v0.6.11 ([`e1e6d3b`](https://github.com/rust-phf/rust-phf/commit/e1e6d3b40a6babddd0989406f2b4e952443ff52e))
+ - Pretty print generated structs ([`96c5ef3`](https://github.com/rust-phf/rust-phf/commit/96c5ef3f80fddb78c0050aa5e15cac1b63ffe542))
+ - Fix string keys in codegen ([`71db0b9`](https://github.com/rust-phf/rust-phf/commit/71db0b9826eb6e1bbcf6c75a599c215d9fb5a5db))
+ - Release v0.6.10 ([`fc45373`](https://github.com/rust-phf/rust-phf/commit/fc45373b34a461664f532c5108f3d2625172c128))
+ - Add doc roots ([`e22cdea`](https://github.com/rust-phf/rust-phf/commit/e22cdea2b24ce65b4de25adbb6cce727f20ac2f5))
+ - Add docs to phf_codegen ([`8b71a9a`](https://github.com/rust-phf/rust-phf/commit/8b71a9a9b9ac9ecf579975327af18f0b6261bbbc))
+ - Fix paths in codegen ([`75b37fd`](https://github.com/rust-phf/rust-phf/commit/75b37fd88cfe4553826317b459a8163b4db8e54b))
+ - Add a codegen crate ([`311bf94`](https://github.com/rust-phf/rust-phf/commit/311bf94f90dcded03d41f54769d2fc29764bc4df))
+</details>
+
diff --git a/third_party/rust/phf_codegen/Cargo.toml b/third_party/rust/phf_codegen/Cargo.toml
new file mode 100644
index 0000000000..5a1d4d4ddc
--- /dev/null
+++ b/third_party/rust/phf_codegen/Cargo.toml
@@ -0,0 +1,29 @@
+# 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"
+rust-version = "1.60"
+name = "phf_codegen"
+version = "0.11.2"
+authors = ["Steven Fackler <sfackler@gmail.com>"]
+description = "Codegen library for PHF types"
+readme = "README.md"
+categories = ["data-structures"]
+license = "MIT"
+repository = "https://github.com/rust-phf/rust-phf"
+resolver = "1"
+
+[dependencies.phf_generator]
+version = "0.11.0"
+
+[dependencies.phf_shared]
+version = "0.11.0"
diff --git a/third_party/rust/phf_codegen/LICENSE b/third_party/rust/phf_codegen/LICENSE
new file mode 100644
index 0000000000..cd5bf6855b
--- /dev/null
+++ b/third_party/rust/phf_codegen/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS 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. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/third_party/rust/phf_codegen/README.md b/third_party/rust/phf_codegen/README.md
new file mode 100644
index 0000000000..a347377afd
--- /dev/null
+++ b/third_party/rust/phf_codegen/README.md
@@ -0,0 +1,127 @@
+# Rust-PHF
+
+[![CI](https://github.com/rust-phf/rust-phf/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-phf/rust-phf/actions/workflows/ci.yml) [![Latest Version](https://img.shields.io/crates/v/phf.svg)](https://crates.io/crates/phf)
+
+[Documentation](https://docs.rs/phf)
+
+Rust-PHF is a library to generate efficient lookup tables at compile time using
+[perfect hash functions](http://en.wikipedia.org/wiki/Perfect_hash_function).
+
+It currently uses the
+[CHD algorithm](http://cmph.sourceforge.net/papers/esa09.pdf) and can generate
+a 100,000 entry map in roughly .4 seconds.
+
+MSRV (minimum supported rust version) is Rust 1.60.
+
+## Usage
+
+PHF data structures can be constructed via either the procedural
+macros in the `phf_macros` crate or code generation supported by the
+`phf_codegen` crate.
+
+To compile the `phf` crate with a dependency on
+libcore instead of libstd, enabling use in environments where libstd
+will not work, set `default-features = false` for the dependency:
+
+```toml
+[dependencies]
+# to use `phf` in `no_std` environments
+phf = { version = "0.11", default-features = false }
+```
+
+### phf_macros
+
+```rust
+use phf::phf_map;
+
+#[derive(Clone)]
+pub enum Keyword {
+ Loop,
+ Continue,
+ Break,
+ Fn,
+ Extern,
+}
+
+static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! {
+ "loop" => Keyword::Loop,
+ "continue" => Keyword::Continue,
+ "break" => Keyword::Break,
+ "fn" => Keyword::Fn,
+ "extern" => Keyword::Extern,
+};
+
+pub fn parse_keyword(keyword: &str) -> Option<Keyword> {
+ KEYWORDS.get(keyword).cloned()
+}
+```
+
+```toml
+[dependencies]
+phf = { version = "0.11", features = ["macros"] }
+```
+
+#### Note
+
+Currently, the macro syntax has some limitations and may not
+work as you want. See [#183] or [#196] for example.
+
+[#183]: https://github.com/rust-phf/rust-phf/issues/183
+[#196]: https://github.com/rust-phf/rust-phf/issues/196
+
+### phf_codegen
+
+To use `phf_codegen` on build.rs, you have to add dependencies under `[build-dependencies]`:
+
+```toml
+[build-dependencies]
+phf = { version = "0.11.1", default-features = false }
+phf_codegen = "0.11.1"
+```
+
+Then put code on build.rs:
+
+```rust
+use std::env;
+use std::fs::File;
+use std::io::{BufWriter, Write};
+use std::path::Path;
+
+fn main() {
+ let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs");
+ let mut file = BufWriter::new(File::create(&path).unwrap());
+
+ write!(
+ &mut file,
+ "static KEYWORDS: phf::Map<&'static str, Keyword> = {}",
+ phf_codegen::Map::new()
+ .entry("loop", "Keyword::Loop")
+ .entry("continue", "Keyword::Continue")
+ .entry("break", "Keyword::Break")
+ .entry("fn", "Keyword::Fn")
+ .entry("extern", "Keyword::Extern")
+ .build()
+ )
+ .unwrap();
+ write!(&mut file, ";\n").unwrap();
+}
+```
+
+and lib.rs:
+
+```rust
+#[derive(Clone)]
+enum Keyword {
+ Loop,
+ Continue,
+ Break,
+ Fn,
+ Extern,
+}
+
+include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
+
+pub fn parse_keyword(keyword: &str) -> Option<Keyword> {
+ KEYWORDS.get(keyword).cloned()
+}
+```
diff --git a/third_party/rust/phf_codegen/src/lib.rs b/third_party/rust/phf_codegen/src/lib.rs
new file mode 100644
index 0000000000..6673c70873
--- /dev/null
+++ b/third_party/rust/phf_codegen/src/lib.rs
@@ -0,0 +1,502 @@
+//! A set of builders to generate Rust source for PHF data structures at
+//! compile time.
+//!
+//! The provided builders are intended to be used in a Cargo build script to
+//! generate a Rust source file that will be included in a library at build
+//! time.
+//!
+//! For more information about `rust-phf` crates, see [the `phf` crate's documentation][phf].
+//!
+//! [phf]: https://docs.rs/phf
+//!
+//! ## Examples
+//!
+//! To use `phf_codegen` on build.rs, you have to add dependencies under `[build-dependencies]`:
+//!
+//! ```toml
+//! [build-dependencies]
+//! phf = { version = "0.11.1", default-features = false }
+//! phf_codegen = "0.11.1"
+//! ```
+//!
+//! Then put code on build.rs:
+//!
+//! ```ignore
+//! use std::env;
+//! use std::fs::File;
+//! use std::io::{BufWriter, Write};
+//! use std::path::Path;
+//!
+//! fn main() {
+//! let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs");
+//! let mut file = BufWriter::new(File::create(&path).unwrap());
+//!
+//! write!(
+//! &mut file,
+//! "static KEYWORDS: phf::Map<&'static str, Keyword> = {}",
+//! phf_codegen::Map::new()
+//! .entry("loop", "Keyword::Loop")
+//! .entry("continue", "Keyword::Continue")
+//! .entry("break", "Keyword::Break")
+//! .entry("fn", "Keyword::Fn")
+//! .entry("extern", "Keyword::Extern")
+//! .build()
+//! )
+//! .unwrap();
+//! write!(&mut file, ";\n").unwrap();
+//! }
+//! ```
+//!
+//! and lib.rs:
+//!
+//! ```ignore
+//! #[derive(Clone)]
+//! enum Keyword {
+//! Loop,
+//! Continue,
+//! Break,
+//! Fn,
+//! Extern,
+//! }
+//!
+//! include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
+//!
+//! pub fn parse_keyword(keyword: &str) -> Option<Keyword> {
+//! KEYWORDS.get(keyword).cloned()
+//! }
+//! ```
+//!
+//! ### Byte-String Keys
+//! Byte strings by default produce references to fixed-size arrays; the compiler needs a hint
+//! to coerce them to slices:
+//!
+//! build.rs:
+//!
+//! ```no_run
+//! use std::env;
+//! use std::fs::File;
+//! use std::io::{BufWriter, Write};
+//! use std::path::Path;
+//!
+//! fn main() {
+//! let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs");
+//! let mut file = BufWriter::new(File::create(&path).unwrap());
+//!
+//! writeln!(
+//! &mut file,
+//! "static KEYWORDS: phf::Map<&'static [u8], Keyword> = \n{};\n",
+//! phf_codegen::Map::<&[u8]>::new()
+//! .entry(b"loop", "Keyword::Loop")
+//! .entry(b"continue", "Keyword::Continue")
+//! .entry(b"break", "Keyword::Break")
+//! .entry(b"fn", "Keyword::Fn")
+//! .entry(b"extern", "Keyword::Extern")
+//! .build()
+//! ).unwrap();
+//! }
+//! ```
+//!
+//! lib.rs:
+//!
+//! ```ignore
+//! #[derive(Clone)]
+//! enum Keyword {
+//! Loop,
+//! Continue,
+//! Break,
+//! Fn,
+//! Extern,
+//! }
+//!
+//! include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
+//!
+//! pub fn parse_keyword(keyword: &[u8]) -> Option<Keyword> {
+//! KEYWORDS.get(keyword).cloned()
+//! }
+//! ```
+//!
+//! ## Note
+//!
+//! The compiler's stack will overflow when processing extremely long method
+//! chains (500+ calls). When generating large PHF data structures, consider
+//! looping over the entries or making each call a separate statement:
+//!
+//! ```rust
+//! let entries = [("hello", "1"), ("world", "2")];
+//!
+//! let mut builder = phf_codegen::Map::new();
+//! for &(key, value) in &entries {
+//! builder.entry(key, value);
+//! }
+//! // ...
+//! ```
+//!
+//! ```rust
+//! let mut builder = phf_codegen::Map::new();
+//! builder.entry("hello", "1");
+//! builder.entry("world", "2");
+//! // ...
+//! ```
+
+#![doc(html_root_url = "https://docs.rs/phf_codegen/0.11")]
+#![allow(clippy::new_without_default)]
+
+use phf_shared::{FmtConst, PhfHash};
+use std::collections::HashSet;
+use std::fmt;
+use std::hash::Hash;
+
+use phf_generator::HashState;
+
+struct Delegate<T>(T);
+
+impl<T: FmtConst> fmt::Display for Delegate<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ self.0.fmt_const(f)
+ }
+}
+
+/// A builder for the `phf::Map` type.
+pub struct Map<K> {
+ keys: Vec<K>,
+ values: Vec<String>,
+ path: String,
+}
+
+impl<K: Hash + PhfHash + Eq + FmtConst> Map<K> {
+ /// Creates a new `phf::Map` builder.
+ pub fn new() -> Map<K> {
+ // FIXME rust#27438
+ //
+ // On Windows/MSVC there are major problems with the handling of dllimport.
+ // Here, because downstream build scripts only invoke generics from phf_codegen,
+ // the linker ends up throwing a way a bunch of static symbols we actually need.
+ // This works around the problem, assuming that all clients call `Map::new` by
+ // calling a non-generic function.
+ fn noop_fix_for_27438() {}
+ noop_fix_for_27438();
+
+ Map {
+ keys: vec![],
+ values: vec![],
+ path: String::from("::phf"),
+ }
+ }
+
+ /// Set the path to the `phf` crate from the global namespace
+ pub fn phf_path(&mut self, path: &str) -> &mut Map<K> {
+ self.path = path.to_owned();
+ self
+ }
+
+ /// Adds an entry to the builder.
+ ///
+ /// `value` will be written exactly as provided in the constructed source.
+ pub fn entry(&mut self, key: K, value: &str) -> &mut Map<K> {
+ self.keys.push(key);
+ self.values.push(value.to_owned());
+ self
+ }
+
+ /// Calculate the hash parameters and return a struct implementing
+ /// [`Display`](::std::fmt::Display) which will print the constructed `phf::Map`.
+ ///
+ /// # Panics
+ ///
+ /// Panics if there are any duplicate keys.
+ pub fn build(&self) -> DisplayMap<'_, K> {
+ let mut set = HashSet::new();
+ for key in &self.keys {
+ if !set.insert(key) {
+ panic!("duplicate key `{}`", Delegate(key));
+ }
+ }
+
+ let state = phf_generator::generate_hash(&self.keys);
+
+ DisplayMap {
+ path: &self.path,
+ keys: &self.keys,
+ values: &self.values,
+ state,
+ }
+ }
+}
+
+/// An adapter for printing a [`Map`](Map).
+pub struct DisplayMap<'a, K> {
+ path: &'a str,
+ state: HashState,
+ keys: &'a [K],
+ values: &'a [String],
+}
+
+impl<'a, K: FmtConst + 'a> fmt::Display for DisplayMap<'a, K> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ // funky formatting here for nice output
+ write!(
+ f,
+ "{}::Map {{
+ key: {:?},
+ disps: &[",
+ self.path, self.state.key
+ )?;
+
+ // write map displacements
+ for &(d1, d2) in &self.state.disps {
+ write!(
+ f,
+ "
+ ({}, {}),",
+ d1, d2
+ )?;
+ }
+
+ write!(
+ f,
+ "
+ ],
+ entries: &[",
+ )?;
+
+ // write map entries
+ for &idx in &self.state.map {
+ write!(
+ f,
+ "
+ ({}, {}),",
+ Delegate(&self.keys[idx]),
+ &self.values[idx]
+ )?;
+ }
+
+ write!(
+ f,
+ "
+ ],
+}}"
+ )
+ }
+}
+
+/// A builder for the `phf::Set` type.
+pub struct Set<T> {
+ map: Map<T>,
+}
+
+impl<T: Hash + PhfHash + Eq + FmtConst> Set<T> {
+ /// Constructs a new `phf::Set` builder.
+ pub fn new() -> Set<T> {
+ Set { map: Map::new() }
+ }
+
+ /// Set the path to the `phf` crate from the global namespace
+ pub fn phf_path(&mut self, path: &str) -> &mut Set<T> {
+ self.map.phf_path(path);
+ self
+ }
+
+ /// Adds an entry to the builder.
+ pub fn entry(&mut self, entry: T) -> &mut Set<T> {
+ self.map.entry(entry, "()");
+ self
+ }
+
+ /// Calculate the hash parameters and return a struct implementing
+ /// [`Display`](::std::fmt::Display) which will print the constructed `phf::Set`.
+ ///
+ /// # Panics
+ ///
+ /// Panics if there are any duplicate keys.
+ pub fn build(&self) -> DisplaySet<'_, T> {
+ DisplaySet {
+ inner: self.map.build(),
+ }
+ }
+}
+
+/// An adapter for printing a [`Set`](Set).
+pub struct DisplaySet<'a, T> {
+ inner: DisplayMap<'a, T>,
+}
+
+impl<'a, T: FmtConst + 'a> fmt::Display for DisplaySet<'a, T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "{}::Set {{ map: {} }}", self.inner.path, self.inner)
+ }
+}
+
+/// A builder for the `phf::OrderedMap` type.
+pub struct OrderedMap<K> {
+ keys: Vec<K>,
+ values: Vec<String>,
+ path: String,
+}
+
+impl<K: Hash + PhfHash + Eq + FmtConst> OrderedMap<K> {
+ /// Constructs a enw `phf::OrderedMap` builder.
+ pub fn new() -> OrderedMap<K> {
+ OrderedMap {
+ keys: vec![],
+ values: vec![],
+ path: String::from("::phf"),
+ }
+ }
+
+ /// Set the path to the `phf` crate from the global namespace
+ pub fn phf_path(&mut self, path: &str) -> &mut OrderedMap<K> {
+ self.path = path.to_owned();
+ self
+ }
+
+ /// Adds an entry to the builder.
+ ///
+ /// `value` will be written exactly as provided in the constructed source.
+ pub fn entry(&mut self, key: K, value: &str) -> &mut OrderedMap<K> {
+ self.keys.push(key);
+ self.values.push(value.to_owned());
+ self
+ }
+
+ /// Calculate the hash parameters and return a struct implementing
+ /// [`Display`](::std::fmt::Display) which will print the constructed
+ /// `phf::OrderedMap`.
+ ///
+ /// # Panics
+ ///
+ /// Panics if there are any duplicate keys.
+ pub fn build(&self) -> DisplayOrderedMap<'_, K> {
+ let mut set = HashSet::new();
+ for key in &self.keys {
+ if !set.insert(key) {
+ panic!("duplicate key `{}`", Delegate(key));
+ }
+ }
+
+ let state = phf_generator::generate_hash(&self.keys);
+
+ DisplayOrderedMap {
+ path: &self.path,
+ state,
+ keys: &self.keys,
+ values: &self.values,
+ }
+ }
+}
+
+/// An adapter for printing a [`OrderedMap`](OrderedMap).
+pub struct DisplayOrderedMap<'a, K> {
+ path: &'a str,
+ state: HashState,
+ keys: &'a [K],
+ values: &'a [String],
+}
+
+impl<'a, K: FmtConst + 'a> fmt::Display for DisplayOrderedMap<'a, K> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(
+ f,
+ "{}::OrderedMap {{
+ key: {:?},
+ disps: &[",
+ self.path, self.state.key
+ )?;
+ for &(d1, d2) in &self.state.disps {
+ write!(
+ f,
+ "
+ ({}, {}),",
+ d1, d2
+ )?;
+ }
+ write!(
+ f,
+ "
+ ],
+ idxs: &[",
+ )?;
+ for &idx in &self.state.map {
+ write!(
+ f,
+ "
+ {},",
+ idx
+ )?;
+ }
+ write!(
+ f,
+ "
+ ],
+ entries: &[",
+ )?;
+ for (key, value) in self.keys.iter().zip(self.values.iter()) {
+ write!(
+ f,
+ "
+ ({}, {}),",
+ Delegate(key),
+ value
+ )?;
+ }
+ write!(
+ f,
+ "
+ ],
+}}"
+ )
+ }
+}
+
+/// A builder for the `phf::OrderedSet` type.
+pub struct OrderedSet<T> {
+ map: OrderedMap<T>,
+}
+
+impl<T: Hash + PhfHash + Eq + FmtConst> OrderedSet<T> {
+ /// Constructs a new `phf::OrderedSet` builder.
+ pub fn new() -> OrderedSet<T> {
+ OrderedSet {
+ map: OrderedMap::new(),
+ }
+ }
+
+ /// Set the path to the `phf` crate from the global namespace
+ pub fn phf_path(&mut self, path: &str) -> &mut OrderedSet<T> {
+ self.map.phf_path(path);
+ self
+ }
+
+ /// Adds an entry to the builder.
+ pub fn entry(&mut self, entry: T) -> &mut OrderedSet<T> {
+ self.map.entry(entry, "()");
+ self
+ }
+
+ /// Calculate the hash parameters and return a struct implementing
+ /// [`Display`](::std::fmt::Display) which will print the constructed
+ /// `phf::OrderedSet`.
+ ///
+ /// # Panics
+ ///
+ /// Panics if there are any duplicate keys.
+ pub fn build(&self) -> DisplayOrderedSet<'_, T> {
+ DisplayOrderedSet {
+ inner: self.map.build(),
+ }
+ }
+}
+
+/// An adapter for printing a [`OrderedSet`](OrderedSet).
+pub struct DisplayOrderedSet<'a, T> {
+ inner: DisplayOrderedMap<'a, T>,
+}
+
+impl<'a, T: FmtConst + 'a> fmt::Display for DisplayOrderedSet<'a, T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(
+ f,
+ "{}::OrderedSet {{ map: {} }}",
+ self.inner.path, self.inner
+ )
+ }
+}