phf_shared-0.11.2/.cargo_vcs_info.json 0000644 00000000150 00000000001 0013214 0 ustar {
"git": {
"sha1": "c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0"
},
"path_in_vcs": "phf_shared"
} phf_shared-0.11.2/CHANGELOG.md 0000644 0000000 0000000 00000071411 10461020230 0013625 0 ustar 0000000 0000000 # 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
- 7 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
view details
* **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 #273 from drewkett/impl-phf-hash-for-slices ([`757012b`](https://github.com/rust-phf/rust-phf/commit/757012bba5eb5056a29c30c708e5c37993c2be1d))
- Add `impl PhfHash` for integer slices ([`272f3d7`](https://github.com/rust-phf/rust-phf/commit/272f3d754457328e8bc765f1f5a56fd8420b0671))
- Merge pull request #262 from Spaceface16518/ptr-size-impl ([`1b88e07`](https://github.com/rust-phf/rust-phf/commit/1b88e07eae51277f99fc08ae6d0171aafdb8cd77))
- 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))
## 0.11.1 (2022-08-08)
### Chore
- Update siphasher to 0.3
### Other
- make uncased feature compatible with no_std
### Commit Statistics
- 197 commits contributed to the release over the course of 2946 calendar days.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **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))
- Add array impl for `usize` and `isize` ([`39fd8a4`](https://github.com/rust-phf/rust-phf/commit/39fd8a4b0042aee2a99deb214ea246610353b859))
- Add `impl PhfBorrow` for `usize` and `isize` ([`34c92ce`](https://github.com/rust-phf/rust-phf/commit/34c92ce9c64236ade571fd1027957857e7e71525))
- Add `impl FmtConst` for `usize` and `isize` ([`da88095`](https://github.com/rust-phf/rust-phf/commit/da8809503abfa9967ed8ed15eb8cdc7db46cf04a))
- Add `impl PhfHash` for `usize` and `isize` ([`c217673`](https://github.com/rust-phf/rust-phf/commit/c217673eaa6370b2590c3b518db58ce1ccc53861))
- Merge pull request #260 from JohnTitor/fix-repo-link ([`1407ebe`](https://github.com/rust-phf/rust-phf/commit/1407ebe536b39611db92d765ddec4de0e6c8a16e))
- Add README.md for some crates ([`e0b34fa`](https://github.com/rust-phf/rust-phf/commit/e0b34fa0a697f45f2c41a875bf84b78a6d3ce079))
- 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 #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 #247 from turbocool3r/master ([`82f9492`](https://github.com/rust-phf/rust-phf/commit/82f9492da736e553e25f7f0b1cdce5dbd486e688))
- Fix build issues. ([`ee82cc9`](https://github.com/rust-phf/rust-phf/commit/ee82cc994573fbb774a0006f13bceb871710fdb6))
- Implement PhfHash for arrays of any size. ([`cf0f6ec`](https://github.com/rust-phf/rust-phf/commit/cf0f6ec2870ab8d9c7339fe72a536c526003263f))
- 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 #232 from petrosagg/no_std_uncased ([`96dbc0d`](https://github.com/rust-phf/rust-phf/commit/96dbc0d936d614cbee980b4e7a6050f6ba84c8a5))
- Make uncased feature compatible with no_std ([`3068a18`](https://github.com/rust-phf/rust-phf/commit/3068a18e997ef04c302a10b51271353897a92027))
- 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 #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))
- 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 #199 from neandrake/fmtconst-string ([`ff45c2e`](https://github.com/rust-phf/rust-phf/commit/ff45c2e9d504ca09494b944bf5f7b3362f97d633))
- Allow using the owned `String` type for `phf` dynamic code generation. ([`58dfc05`](https://github.com/rust-phf/rust-phf/commit/58dfc05a7d27ac506016186970b4f3697c1c6475))
- 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 #168 from abonander/167-std-default ([`a932094`](https://github.com/rust-phf/rust-phf/commit/a93209486f5874515da0483002e8669b2dbf95e6))
- Switch optional `core` feature to default `std` feature ([`645e23d`](https://github.com/rust-phf/rust-phf/commit/645e23dda30ac1b99af39f201a74211e7ac3251a))
- Merge pull request #164 from abonander/perf-improvements ([`70129c6`](https://github.com/rust-phf/rust-phf/commit/70129c6fbcdf428ce9f1014eea935301ac70e410))
- Use sip128 instead of hashing twice ([`a8e67c3`](https://github.com/rust-phf/rust-phf/commit/a8e67c37486974f810737add6fce73e82aeb39aa))
- 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))
- Fix formatting for arrays after #156 ([`40c1476`](https://github.com/rust-phf/rust-phf/commit/40c147691acd4996fc6883a05734fc6da125143d))
- Merge pull request #156 from abonander/slice-fix ([`56ff009`](https://github.com/rust-phf/rust-phf/commit/56ff0090ed04bc4d3bbc06de36884f0dfac0d100))
- Fix `FmtConst` for `[u8]` ([`12b4fde`](https://github.com/rust-phf/rust-phf/commit/12b4fde5850f2de79e9cf5163689624a3a9787a1))
- Merge pull request #144 from ignatenkobrain/patch-1 ([`7b415a4`](https://github.com/rust-phf/rust-phf/commit/7b415a424ef45ae66131a004ea4180c18ff53ef2))
- Merge branch 'master' into patch-1 ([`cd0d7ce`](https://github.com/rust-phf/rust-phf/commit/cd0d7ce1194252dcaca3153988ba2a4effa66b4f))
- Merge pull request #155 from abonander/128-bit-ints ([`6749552`](https://github.com/rust-phf/rust-phf/commit/674955292a7028752f2eb25e34c27e881f6b11a1))
- Implement support for 128-bit ints and fix high magnitude vals ([`5be5919`](https://github.com/rust-phf/rust-phf/commit/5be59199389c0703fff62f640eb1a0d19243fc48))
- 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))
- Update siphasher to 0.3 ([`71977b2`](https://github.com/rust-phf/rust-phf/commit/71977b26194ce6049a063131792760933952424b))
- Release v0.7.24 ([`1287414`](https://github.com/rust-phf/rust-phf/commit/1287414b1302d2d717c5f4be81accf4c12ccad48))
- Downgrade siphasher ([`54dd1e2`](https://github.com/rust-phf/rust-phf/commit/54dd1e22ccb0788fab5240feb5502e02c7b034b9))
- Upgrade rand and siphasher ([`80d9894`](https://github.com/rust-phf/rust-phf/commit/80d9894e5db7b5a8acf5b89716ee506de2a95b99))
- 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))
- Switch to non-deprecated SipHasher ([`fb3c115`](https://github.com/rust-phf/rust-phf/commit/fb3c115a306e6e0a12b88e12d7178857dbc5f66e))
- 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 pull request #91 from Bobo1239/master ([`bf472f2`](https://github.com/rust-phf/rust-phf/commit/bf472f2baed1552530a80c95ba5872a78fd68a5c))
- Add UniCase support to phf_macros and bump unicase version ([`2af3abb`](https://github.com/rust-phf/rust-phf/commit/2af3abb00cafc85d43755e43767a2a8b274f6670))
- 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 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))
- Drop all rust features ([`888f623`](https://github.com/rust-phf/rust-phf/commit/888f6234cd4e26e08b1f2d3716e4d4e0b95d0196))
- Conditionally compile String and Vec impls ([`8105ae8`](https://github.com/rust-phf/rust-phf/commit/8105ae8f6c1e4fde641716521b327eb07cf648cc))
- Implement PhfHash for String and Vec ([`ae820e6`](https://github.com/rust-phf/rust-phf/commit/ae820e6b8c8b4a46083ea4105ec3b378d52e8db0))
- 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))
- Simplify no_std logic a bit ([`70f2ed9`](https://github.com/rust-phf/rust-phf/commit/70f2ed93d2e64b822bf2a23fde0ee848e8785bd1))
- Merge pull request #68 from gz/master ([`44006f7`](https://github.com/rust-phf/rust-phf/commit/44006f74efca95d4f049bbf25df6321977c39577))
- Reinstantiate no_std cargo feature flag. ([`7c3f757`](https://github.com/rust-phf/rust-phf/commit/7c3f757cdc83b4035d81f0d521b4b80b9080155e))
- 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 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 #62 from SimonSapin/string-cache ([`6f59718`](https://github.com/rust-phf/rust-phf/commit/6f5971869e5864cae653ec3606d17b554c343ef8))
- Add hash() and get_index() to phf_shared. ([`d3b2ea0`](https://github.com/rust-phf/rust-phf/commit/d3b2ea0f0a9bd9cb79da90d8795f1905c3df1f5f))
- Update PhfHash to mirror std::hash::Hash ([`96ef156`](https://github.com/rust-phf/rust-phf/commit/96ef156baae669b233673d6be2b96617ad48551e))
- Make PhfHash endianness-independent ([`8f406b9`](https://github.com/rust-phf/rust-phf/commit/8f406b910a2ec0f389b977614f8de3151bb17070))
- Release v0.7.3 ([`77ea239`](https://github.com/rust-phf/rust-phf/commit/77ea23917e908b10c4c5c463671a8409292f8661))
- 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))
- 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))
- Release v0.6.14 ([`cf64ebb`](https://github.com/rust-phf/rust-phf/commit/cf64ebb8f769c9f12c9a03d05713dde6b8caf371))
- Merge pull request #50 from o01eg/patch-1 ([`5a3309b`](https://github.com/rust-phf/rust-phf/commit/5a3309b50e5685816c7712072df887890eba0823))
- Update to rustc 1.0.0-dev (e46610966 2015-03-17) (built 2015-03-17) ([`54f32dd`](https://github.com/rust-phf/rust-phf/commit/54f32dd4cba60fd4833cd2cf0e1030cfd9a9ca4b))
- Release v0.6.13 ([`4fdb533`](https://github.com/rust-phf/rust-phf/commit/4fdb5331fd9978ca3e180a06fb2e34627f50fb77))
- Release v0.6.12 ([`59ca586`](https://github.com/rust-phf/rust-phf/commit/59ca58637206c9806c13cc24cb35cb7d0ce9d23f))
- Release v0.6.11 ([`e1e6d3b`](https://github.com/rust-phf/rust-phf/commit/e1e6d3b40a6babddd0989406f2b4e952443ff52e))
- Release v0.6.10 ([`fc45373`](https://github.com/rust-phf/rust-phf/commit/fc45373b34a461664f532c5108f3d2625172c128))
- Add doc URLs ([`4605db3`](https://github.com/rust-phf/rust-phf/commit/4605db3e7e0c4bef09ccf6c09c7dbcc36b707a9f))
- Remove core feature ([`d4c189a`](https://github.com/rust-phf/rust-phf/commit/d4c189a2b060df33e7c97d6c1f0f430b68fc23b5))
- Release v0.6.9 ([`822f4e3`](https://github.com/rust-phf/rust-phf/commit/822f4e3fb127dc02d36d802803d71aa5b98bed3c))
- More fixes ([`0c04b9c`](https://github.com/rust-phf/rust-phf/commit/0c04b9cb2679a63394778a7362ef14441b6c2032))
- Fix for upstream changes ([`f014882`](https://github.com/rust-phf/rust-phf/commit/f01488236a8e944f1b12b4bc441d55c10fc47aa1))
- Release v0.6.8 ([`cd637ca`](https://github.com/rust-phf/rust-phf/commit/cd637cafb6d37b1901b6c119a7d26f253e9a288e))
- Release v0.6.7 ([`bfc36c9`](https://github.com/rust-phf/rust-phf/commit/bfc36c979225f652cdb72f3b1f2a25e77b50ab8c))
- Fix for upstream changes ([`5ff7040`](https://github.com/rust-phf/rust-phf/commit/5ff70403a1b12c30206b128ac619b31c69e42eb4))
- Release v0.6.6 ([`b09a174`](https://github.com/rust-phf/rust-phf/commit/b09a174a166c7744c5989bedc6ba68340f6f7fd1))
- Release v0.6.5 ([`271e784`](https://github.com/rust-phf/rust-phf/commit/271e7848f35b31d6ce9fc9268de173738464bfc8))
- Fix for upstream changes ([`3db7cef`](https://github.com/rust-phf/rust-phf/commit/3db7cef414e4de28eb6c18938c275a3aafbdafa4))
- Move docs to this repo and auto build them ([`f8ef160`](https://github.com/rust-phf/rust-phf/commit/f8ef160480e2d4ce72fa7afb6ebce70e45acbc76))
- Release v0.6.4 ([`6866c1b`](https://github.com/rust-phf/rust-phf/commit/6866c1bf5ad5091bc969f1356884aa86c27458cb))
- Release v0.6.3 ([`b0c5e3c`](https://github.com/rust-phf/rust-phf/commit/b0c5e3cb69742f81160ea80a3ba1782a0b4e01a2))
- Release v0.6.2 ([`d9ddf45`](https://github.com/rust-phf/rust-phf/commit/d9ddf45b15ba812b0d3acedffb08e901742e56c4))
- Link to libstd by default ([`24555b1`](https://github.com/rust-phf/rust-phf/commit/24555b19e6b54656633cc4ceac91864f14c20471))
- Release v0.6.1 ([`ca0e9f6`](https://github.com/rust-phf/rust-phf/commit/ca0e9f6b9c737f3d11bcad2f4624bb5603a8170e))
- Fix for stability changes ([`f7fb510`](https://github.com/rust-phf/rust-phf/commit/f7fb510dfe67f11522a2d214bd14d21f910bfd7b))
- Release v0.6.0 ([`09d6870`](https://github.com/rust-phf/rust-phf/commit/09d687053caf4d321f72907528573b3334fae3c2))
- Release v0.5.0 ([`8683be2`](https://github.com/rust-phf/rust-phf/commit/8683be260effe5605243ef230bad6154ef4e5e20))
- Fix deprecation warning ([`d0fa86a`](https://github.com/rust-phf/rust-phf/commit/d0fa86a1f37f118382a3dc4400de158f8d181a2a))
- Release v0.4.9 ([`28cbe70`](https://github.com/rust-phf/rust-phf/commit/28cbe704e0f96495c2527ad93c5e67315c245908))
- Fix for upstream changes ([`0b22188`](https://github.com/rust-phf/rust-phf/commit/0b22188f5767a0a125d01ed8b176ce19fef95cad))
- Release v0.4.8 ([`bb858f1`](https://github.com/rust-phf/rust-phf/commit/bb858f11dd88579d47b0089121f8d551731464ab))
- Merge pull request #38 from chris-morgan/master ([`668f986`](https://github.com/rust-phf/rust-phf/commit/668f986705ba3a6385b47b851878250ce954a6dc))
- Release v0.4.7 ([`d83f551`](https://github.com/rust-phf/rust-phf/commit/d83f551a874a24b2a4308804e7cbca32a1aa2494))
- Fix for upstream changes ([`c3ae5ac`](https://github.com/rust-phf/rust-phf/commit/c3ae5ac94cfa11404b420d45229c3a0d0d8a4535))
- Release v0.4.6 ([`360bf81`](https://github.com/rust-phf/rust-phf/commit/360bf81ad3aafced75dc64a49e58a867d5239264))
- Release v0.4.5 ([`ab4786c`](https://github.com/rust-phf/rust-phf/commit/ab4786c09b55e46658f2a66092caf6a782d056a6))
- Release v0.4.4 ([`f678635`](https://github.com/rust-phf/rust-phf/commit/f678635378555b7d086014b0466aea12a3ae5701))
- Fix for upstream changes ([`2b4863f`](https://github.com/rust-phf/rust-phf/commit/2b4863fcb5827d5bd89cc278d2a3052b6b3ee20e))
- Release v0.4.3 ([`4f5902c`](https://github.com/rust-phf/rust-phf/commit/4f5902c222a81da009bf7955bc96568c73b46b13))
- Release v0.4.2 ([`69d92b8`](https://github.com/rust-phf/rust-phf/commit/69d92b869fab51a31fda6126003edadd9e832b32))
- Merge pull request #37 from alexcrichton/update ([`b9f0a43`](https://github.com/rust-phf/rust-phf/commit/b9f0a43500499fc08170690bdc6624f289e35841))
- Update to rust master ([`4a0d48d`](https://github.com/rust-phf/rust-phf/commit/4a0d48d165d78d1b3e8f791503e220a032d26d24))
- Release v0.4.1 ([`0fba837`](https://github.com/rust-phf/rust-phf/commit/0fba8374fd6fb1b10d9d456ae4b1310b00e9d9ca))
- Make sure we're actually no_std ([`126c6e2`](https://github.com/rust-phf/rust-phf/commit/126c6e26345113bc7492c8ef920ad609b0b25af7))
- Re-fix str and [u8] hashing when cross compiling ([`a0eb200`](https://github.com/rust-phf/rust-phf/commit/a0eb200d87971555d3d7ce8498404844c860a47f))
- Release v0.4.0 ([`49dbb36`](https://github.com/rust-phf/rust-phf/commit/49dbb3636621c0436e771a4e0ebfe7342b676616))
- Fix for upstream changes and drop xxhash ([`fc2539f`](https://github.com/rust-phf/rust-phf/commit/fc2539f7893ef0f833a8c13ec77ba317bd8bf43e))
- Release v0.3.0 ([`0a80b06`](https://github.com/rust-phf/rust-phf/commit/0a80b06ecde77b33cec8c956c67704613fdd313e))
- Merge pull request #32 from sp3d/master ([`fc4829a`](https://github.com/rust-phf/rust-phf/commit/fc4829a292663e4e30a23a4ba1de693d154cd611))
- Add support for [u8, ..N] keys ([`e26947c`](https://github.com/rust-phf/rust-phf/commit/e26947cc264266bcbc85b8cf5c46b2019d654c72))
- Bump to 0.2 ([`4546f51`](https://github.com/rust-phf/rust-phf/commit/4546f51fccbd56ddf1214fe232db8926d9f471de))
- Bump to 0.1.0 ([`43d9a50`](https://github.com/rust-phf/rust-phf/commit/43d9a50e6240716d68dadd9d037f22b2f7df4b58))
- Make publishable on crates.io ([`4ad2bb2`](https://github.com/rust-phf/rust-phf/commit/4ad2bb27be35015b3f37ec7025c46df9170b3ef9))
- Pull shared code into a module ([`19c4f8d`](https://github.com/rust-phf/rust-phf/commit/19c4f8d420d3a9ff8e3ace0256198f5db9fccae0))
phf_shared-0.11.2/Cargo.toml 0000644 00000002065 00000000001 0011221 0 ustar # 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_shared"
version = "0.11.2"
authors = ["Steven Fackler "]
description = "Support code shared by PHF libraries"
readme = "README.md"
categories = ["data-structures"]
license = "MIT"
repository = "https://github.com/rust-phf/rust-phf"
resolver = "1"
[lib]
name = "phf_shared"
path = "src/lib.rs"
test = false
[dependencies.siphasher]
version = "0.3"
[dependencies.uncased]
version = "0.9.6"
optional = true
default-features = false
[dependencies.unicase]
version = "2.4.0"
optional = true
[features]
default = ["std"]
std = []
phf_shared-0.11.2/Cargo.toml.orig 0000644 0000000 0000000 00000001072 10461020230 0014677 0 ustar 0000000 0000000 [package]
name = "phf_shared"
authors = ["Steven Fackler "]
version = "0.11.2"
license = "MIT"
description = "Support code shared by PHF libraries"
repository = "https://github.com/rust-phf/rust-phf"
edition = "2021"
rust-version = "1.60"
categories = ["data-structures"]
readme = "README.md"
[lib]
name = "phf_shared"
path = "src/lib.rs"
test = false
[features]
default = ["std"]
std = []
[dependencies]
siphasher = "0.3"
unicase = { version = "2.4.0", optional = true }
uncased = { version = "0.9.6", optional = true, default-features = false }
phf_shared-0.11.2/LICENSE 0000644 0000000 0000000 00000002113 10461020230 0013012 0 ustar 0000000 0000000 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.
phf_shared-0.11.2/README.md 0000644 0000000 0000000 00000000177 10461020230 0013274 0 ustar 0000000 0000000 # phf_shared
This crate is for the `phf` crate, [find it on crates.io][phf] for details.
[phf]: https://crates.io/crates/phf
phf_shared-0.11.2/src/lib.rs 0000644 0000000 0000000 00000026004 10461020230 0013715 0 ustar 0000000 0000000 //! See [the `phf` crate's documentation][phf] for details.
//!
//! [phf]: https://docs.rs/phf
#![doc(html_root_url = "https://docs.rs/phf_shared/0.11")]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
extern crate std as core;
use core::fmt;
use core::hash::{Hash, Hasher};
use core::num::Wrapping;
use siphasher::sip128::{Hash128, Hasher128, SipHasher13};
#[non_exhaustive]
pub struct Hashes {
pub g: u32,
pub f1: u32,
pub f2: u32,
}
/// A central typedef for hash keys
///
/// Makes experimentation easier by only needing to be updated here.
pub type HashKey = u64;
#[inline]
pub fn displace(f1: u32, f2: u32, d1: u32, d2: u32) -> u32 {
(Wrapping(d2) + Wrapping(f1) * Wrapping(d1) + Wrapping(f2)).0
}
/// `key` is from `phf_generator::HashState`.
#[inline]
pub fn hash(x: &T, key: &HashKey) -> Hashes {
let mut hasher = SipHasher13::new_with_keys(0, *key);
x.phf_hash(&mut hasher);
let Hash128 {
h1: lower,
h2: upper,
} = hasher.finish128();
Hashes {
g: (lower >> 32) as u32,
f1: lower as u32,
f2: upper as u32,
}
}
/// Return an index into `phf_generator::HashState::map`.
///
/// * `hash` is from `hash()` in this crate.
/// * `disps` is from `phf_generator::HashState::disps`.
/// * `len` is the length of `phf_generator::HashState::map`.
#[inline]
pub fn get_index(hashes: &Hashes, disps: &[(u32, u32)], len: usize) -> u32 {
let (d1, d2) = disps[(hashes.g % (disps.len() as u32)) as usize];
displace(hashes.f1, hashes.f2, d1, d2) % (len as u32)
}
/// A trait implemented by types which can be used in PHF data structures.
///
/// This differs from the standard library's `Hash` trait in that `PhfHash`'s
/// results must be architecture independent so that hashes will be consistent
/// between the host and target when cross compiling.
pub trait PhfHash {
/// Feeds the value into the state given, updating the hasher as necessary.
fn phf_hash(&self, state: &mut H);
/// Feeds a slice of this type into the state provided.
fn phf_hash_slice(data: &[Self], state: &mut H)
where
Self: Sized,
{
for piece in data {
piece.phf_hash(state);
}
}
}
/// Trait for printing types with `const` constructors, used by `phf_codegen` and `phf_macros`.
pub trait FmtConst {
/// Print a `const` expression representing this value.
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result;
}
/// Identical to `std::borrow::Borrow` except omitting blanket impls to facilitate other
/// borrowing patterns.
///
/// The same semantic requirements apply:
///
/// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and owned values:
/// `x.borrow() == y.borrow()` should give the same result as `x == y`.
///
/// (This crate's API only requires `Eq` and `PhfHash`, however.)
///
/// ### Motivation
/// The conventional signature for lookup methods on collections looks something like this:
///
/// ```ignore
/// impl Map where K: PhfHash + Eq {
/// fn get(&self, key: &T) -> Option<&V> where T: PhfHash + Eq, K: Borrow {
/// ...
/// }
/// }
/// ```
///
/// This allows the key type used for lookup to be different than the key stored in the map so for
/// example you can use `&str` to look up a value in a `Map`. However, this runs into
/// a problem in the case where `T` and `K` are both a `Foo<_>` type constructor but
/// the contained type is different (even being the same type with different lifetimes).
///
/// The main issue for this crate's API is that, with this method signature, you cannot perform a
/// lookup on a `Map, _>` with a `UniCase<&'a str>` where `'a` is not
/// `'static`; there is no impl of `Borrow` that resolves to
/// `impl Borrow> for UniCase<&'static str>` and one cannot be added either because of
/// all the blanket impls.
///
/// Instead, this trait is implemented conservatively, without blanket impls, so that impls like
/// this may be added. This is feasible since the set of types that implement `PhfHash` is
/// intentionally small.
///
/// This likely won't be fixable with specialization alone but will require full support for lattice
/// impls since we technically want to add overlapping blanket impls.
pub trait PhfBorrow {
/// Convert a reference to `self` to a reference to the borrowed type.
fn borrow(&self) -> &B;
}
/// Create an impl of `FmtConst` delegating to `fmt::Debug` for types that can deal with it.
///
/// Ideally with specialization this could be just one default impl and then specialized where
/// it doesn't apply.
macro_rules! delegate_debug (
($ty:ty) => {
impl FmtConst for $ty {
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}
}
);
delegate_debug!(str);
delegate_debug!(char);
delegate_debug!(u8);
delegate_debug!(i8);
delegate_debug!(u16);
delegate_debug!(i16);
delegate_debug!(u32);
delegate_debug!(i32);
delegate_debug!(u64);
delegate_debug!(i64);
delegate_debug!(usize);
delegate_debug!(isize);
delegate_debug!(u128);
delegate_debug!(i128);
delegate_debug!(bool);
/// `impl PhfBorrow for T`
macro_rules! impl_reflexive(
($($t:ty),*) => (
$(impl PhfBorrow<$t> for $t {
fn borrow(&self) -> &$t {
self
}
})*
)
);
impl_reflexive!(
str,
char,
u8,
i8,
u16,
i16,
u32,
i32,
u64,
i64,
usize,
isize,
u128,
i128,
bool,
[u8]
);
#[cfg(feature = "std")]
impl PhfBorrow for String {
fn borrow(&self) -> &str {
self
}
}
#[cfg(feature = "std")]
impl PhfBorrow<[u8]> for Vec {
fn borrow(&self) -> &[u8] {
self
}
}
#[cfg(feature = "std")]
delegate_debug!(String);
#[cfg(feature = "std")]
impl PhfHash for String {
#[inline]
fn phf_hash(&self, state: &mut H) {
(**self).phf_hash(state)
}
}
#[cfg(feature = "std")]
impl PhfHash for Vec {
#[inline]
fn phf_hash(&self, state: &mut H) {
(**self).phf_hash(state)
}
}
impl<'a, T: 'a + PhfHash + ?Sized> PhfHash for &'a T {
fn phf_hash(&self, state: &mut H) {
(*self).phf_hash(state)
}
}
impl<'a, T: 'a + FmtConst + ?Sized> FmtConst for &'a T {
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(*self).fmt_const(f)
}
}
impl<'a> PhfBorrow for &'a str {
fn borrow(&self) -> &str {
self
}
}
impl<'a> PhfBorrow<[u8]> for &'a [u8] {
fn borrow(&self) -> &[u8] {
self
}
}
impl PhfHash for str {
#[inline]
fn phf_hash(&self, state: &mut H) {
self.as_bytes().phf_hash(state)
}
}
impl PhfHash for [u8] {
#[inline]
fn phf_hash(&self, state: &mut H) {
state.write(self);
}
}
impl FmtConst for [u8] {
#[inline]
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// slices need a leading reference
write!(f, "&{:?}", self)
}
}
#[cfg(feature = "unicase")]
impl PhfHash for unicase::UniCase
where
unicase::UniCase: Hash,
{
#[inline]
fn phf_hash(&self, state: &mut H) {
self.hash(state)
}
}
#[cfg(feature = "unicase")]
impl FmtConst for unicase::UniCase
where
S: AsRef,
{
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.is_ascii() {
f.write_str("UniCase::ascii(")?;
} else {
f.write_str("UniCase::unicode(")?;
}
self.as_ref().fmt_const(f)?;
f.write_str(")")
}
}
#[cfg(feature = "unicase")]
impl<'b, 'a: 'b, S: ?Sized + 'a> PhfBorrow> for unicase::UniCase<&'a S> {
fn borrow(&self) -> &unicase::UniCase<&'b S> {
self
}
}
#[cfg(feature = "uncased")]
impl PhfHash for uncased::UncasedStr {
#[inline]
fn phf_hash(&self, state: &mut H) {
self.hash(state)
}
}
#[cfg(feature = "uncased")]
impl FmtConst for uncased::UncasedStr {
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// transmute is not stable in const fns (rust-lang/rust#53605), so
// `UncasedStr::new` can't be a const fn itself, but we can inline the
// call to transmute here in the meantime.
f.write_str("unsafe { ::core::mem::transmute::<&'static str, &'static UncasedStr>(")?;
self.as_str().fmt_const(f)?;
f.write_str(") }")
}
}
#[cfg(feature = "uncased")]
impl PhfBorrow for &uncased::UncasedStr {
fn borrow(&self) -> &uncased::UncasedStr {
self
}
}
macro_rules! sip_impl (
(le $t:ty) => (
impl PhfHash for $t {
#[inline]
fn phf_hash(&self, state: &mut H) {
self.to_le().hash(state);
}
}
);
($t:ty) => (
impl PhfHash for $t {
#[inline]
fn phf_hash(&self, state: &mut H) {
self.hash(state);
}
}
)
);
sip_impl!(u8);
sip_impl!(i8);
sip_impl!(le u16);
sip_impl!(le i16);
sip_impl!(le u32);
sip_impl!(le i32);
sip_impl!(le u64);
sip_impl!(le i64);
sip_impl!(le usize);
sip_impl!(le isize);
sip_impl!(le u128);
sip_impl!(le i128);
sip_impl!(bool);
impl PhfHash for char {
#[inline]
fn phf_hash(&self, state: &mut H) {
(*self as u32).phf_hash(state)
}
}
// minimize duplicated code since formatting drags in quite a bit
fn fmt_array(array: &[T], f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", array)
}
macro_rules! array_impl (
($t:ty) => (
impl PhfHash for [$t; N] {
#[inline]
fn phf_hash(&self, state: &mut H) {
for v in &self[..] {
v.phf_hash(state);
}
}
}
impl FmtConst for [$t; N] {
fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt_array(self, f)
}
}
impl PhfBorrow<[$t]> for [$t; N] {
fn borrow(&self) -> &[$t] {
self
}
}
)
);
array_impl!(u8);
array_impl!(i8);
array_impl!(u16);
array_impl!(i16);
array_impl!(u32);
array_impl!(i32);
array_impl!(u64);
array_impl!(i64);
array_impl!(usize);
array_impl!(isize);
array_impl!(u128);
array_impl!(i128);
array_impl!(bool);
array_impl!(char);
macro_rules! slice_impl (
($t:ty) => {
impl PhfHash for [$t] {
#[inline]
fn phf_hash(&self, state: &mut H) {
for v in self {
v.phf_hash(state);
}
}
}
};
);
slice_impl!(i8);
slice_impl!(u16);
slice_impl!(i16);
slice_impl!(u32);
slice_impl!(i32);
slice_impl!(u64);
slice_impl!(i64);
slice_impl!(usize);
slice_impl!(isize);
slice_impl!(u128);
slice_impl!(i128);
slice_impl!(bool);
slice_impl!(char);