diff options
Diffstat (limited to 'vendor/gix-attributes')
-rw-r--r-- | vendor/gix-attributes/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-attributes/CHANGELOG.md | 244 | ||||
-rw-r--r-- | vendor/gix-attributes/Cargo.toml | 25 | ||||
-rw-r--r-- | vendor/gix-attributes/src/lib.rs | 11 | ||||
-rw-r--r-- | vendor/gix-attributes/src/name.rs | 10 | ||||
-rw-r--r-- | vendor/gix-attributes/src/parse.rs | 5 | ||||
-rw-r--r-- | vendor/gix-attributes/src/search/attributes.rs | 39 | ||||
-rw-r--r-- | vendor/gix-attributes/src/search/mod.rs | 8 | ||||
-rw-r--r-- | vendor/gix-attributes/src/search/outcome.rs | 75 | ||||
-rw-r--r-- | vendor/gix-attributes/src/search/refmap.rs | 4 | ||||
-rw-r--r-- | vendor/gix-attributes/src/state.rs | 41 |
11 files changed, 391 insertions, 73 deletions
diff --git a/vendor/gix-attributes/.cargo-checksum.json b/vendor/gix-attributes/.cargo-checksum.json index b08b0f46c..7a1ce1338 100644 --- a/vendor/gix-attributes/.cargo-checksum.json +++ b/vendor/gix-attributes/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"1b46038b08fc83d41a1342c47f0ad58b018758d433887aee02d12b70c99a796a","Cargo.toml":"86c38d07e300efe6c1349c52eba7b03a7d954731ce060b2ccd5ad85f7a2f4987","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/assignment.rs":"779ab52656857bee716823315e440f6ac8577dd8cc2c7e084e2791e06755a537","src/lib.rs":"d0abd5cf5f07b08e8303aef14f436ce767b540dfcfb5b68704e42dc80593bd93","src/name.rs":"6020a168779414bda21227d5486781a0238b379c4b05d19da8ac3ae27c671887","src/parse.rs":"3277b36bf1989440f5428b9c2087645bdd818c8d992cb4c550aa3f591f725a67","src/search/attributes.rs":"f3af41637eb11f49af19d5db0fdbe53817cc8708243d81706c289129e7c88bc6","src/search/mod.rs":"664c13e8251178336b0b5c28f5a306b6d7ff53b02fc1f67e3aa156a0f2fac9f7","src/search/outcome.rs":"82cdc4fde664a2b93da33c8a405adf2a3dab4ba10a7a224ea94df18a78607e1e","src/search/refmap.rs":"0f83f7990c974c964c9a2352545364d15a63872569a746af34540712d3318bc5","src/source.rs":"81092fff85f1f31c8daa1bac313ffd44511c64617e272d4f4225ed714bf89464","src/state.rs":"e1bfb884471a7ef49301c38d2666c91de6105b02d958a6ea9ffaab709057a2e7"},"package":"78b79590ac382f80d87e06416f5fcac6fee5d83dcb152a00ed0bdbaa988acc31"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"248497e6900b4d3cbd8ccb2f9106a5320d4937a41b431714df2159d43f33d0b0","Cargo.toml":"75b41f081632894eb22d51a47fb5528b5938283240d6fcc247e541e62143da83","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/assignment.rs":"779ab52656857bee716823315e440f6ac8577dd8cc2c7e084e2791e06755a537","src/lib.rs":"6f4141f34abf9327defcb42878d8d9bd6c201d03cee279806932b8163f751bdb","src/name.rs":"6e836c21bab5fa4a3cdd8ff06a5c50b71ae14b67996955c232eeb81f96a65da6","src/parse.rs":"3a455fb8b76bf1d572d3e28577243ef177190a6b8e4b64ed48521abb1d71c71c","src/search/attributes.rs":"a8ae59f5c34941a8a49dde1c214f67971b397a6b3c8c50b95963ac0b8ca587f3","src/search/mod.rs":"4944ca12129e7a75e4edc0b787f7749bbc632814435980bf45f5d98926e6aa87","src/search/outcome.rs":"cc906556a3c4420ede6d4944f00164d8eed44d3f05c8b40a92e9f0a41748b13a","src/search/refmap.rs":"08bba1460e70966ea84a2604621ab480b28e3102c75f17033a457cfa132d5f80","src/source.rs":"81092fff85f1f31c8daa1bac313ffd44511c64617e272d4f4225ed714bf89464","src/state.rs":"708db0b6c37e97fa32cd8b59776528e3401ee883b8a7f35f77f9de3a270e70d8"},"package":"2451665e70709ba4753b623ef97511ee98c4a73816b2c5b5df25678d607ed820"}
\ No newline at end of file diff --git a/vendor/gix-attributes/CHANGELOG.md b/vendor/gix-attributes/CHANGELOG.md index f9b3a2fdf..fdc678344 100644 --- a/vendor/gix-attributes/CHANGELOG.md +++ b/vendor/gix-attributes/CHANGELOG.md @@ -5,6 +5,247 @@ 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). +## 0.19.0 (2023-09-24) + +### New Features (BREAKING) + + - <csr-id-7911d53b48263c35d9684e1a329588499eadd822/> Use `yarn` for lower memory footprint and better performance. + However, this also removes `serde` support for now. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release over the course of 14 calendar days. + - 16 days passed between releases. + - 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** + - Prepare changelogs prior to release ([`8a60d5b`](https://github.com/Byron/gitoxide/commit/8a60d5b80877c213c3b646d3061e8a33e0e433ec)) + - Merge branch 'yarn' ([`53bbd06`](https://github.com/Byron/gitoxide/commit/53bbd06d2b4380452d24d2c999f43b489b7446af)) + - Use `yarn` for lower memory footprint and better performance. ([`7911d53`](https://github.com/Byron/gitoxide/commit/7911d53b48263c35d9684e1a329588499eadd822)) +</details> + +## 0.18.0 (2023-09-08) + +### New Features + + - <csr-id-2b8d09f785f471aa12fc6793f0ea40c1f8d9ea4a/> remove `log` dependency in favor of `gix-trace` + - <csr-id-7df8cf31f794ae75868c606329a5685d198b0f59/> make it easier to access the value of `StateRef`. + +### Bug Fixes (BREAKING) + + - <csr-id-072ee32f693a31161cd6a843da6582d13efbb20b/> use `dyn` trait where possible. + This reduces compile time due to avoiding duplication. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 9 commits contributed to the release over the course of 17 calendar days. + - 17 days passed between releases. + - 3 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** + - Release gix-date v0.8.0, gix-hash v0.13.0, gix-features v0.34.0, gix-actor v0.26.0, gix-object v0.36.0, gix-path v0.10.0, gix-glob v0.12.0, gix-attributes v0.18.0, gix-packetline-blocking v0.16.6, gix-filter v0.4.0, gix-fs v0.6.0, gix-commitgraph v0.20.0, gix-hashtable v0.4.0, gix-revwalk v0.7.0, gix-traverse v0.32.0, gix-worktree-stream v0.4.0, gix-archive v0.4.0, gix-config-value v0.14.0, gix-tempfile v9.0.0, gix-lock v9.0.0, gix-ref v0.36.0, gix-sec v0.10.0, gix-config v0.29.0, gix-prompt v0.7.0, gix-url v0.23.0, gix-credentials v0.19.0, gix-diff v0.35.0, gix-discover v0.24.0, gix-ignore v0.7.0, gix-index v0.24.0, gix-macros v0.1.0, gix-mailmap v0.18.0, gix-negotiate v0.7.0, gix-pack v0.42.0, gix-odb v0.52.0, gix-pathspec v0.2.0, gix-packetline v0.16.6, gix-transport v0.36.0, gix-protocol v0.39.0, gix-revision v0.21.0, gix-refspec v0.17.0, gix-submodule v0.3.0, gix-worktree v0.25.0, gix-worktree-state v0.2.0, gix v0.53.0, safety bump 39 crates ([`8bd0456`](https://github.com/Byron/gitoxide/commit/8bd045676bb2cdc02624ab93e73ff8518064ca38)) + - Prepare changelogs for release ([`375db06`](https://github.com/Byron/gitoxide/commit/375db06a8442378c3f7a922fae38e2a6694d9d04)) + - Merge branch 'optimizations' ([`6135a5e`](https://github.com/Byron/gitoxide/commit/6135a5ea8709646f01da62939a59dd3a9750e007)) + - Remove `log` dependency in favor of `gix-trace` ([`2b8d09f`](https://github.com/Byron/gitoxide/commit/2b8d09f785f471aa12fc6793f0ea40c1f8d9ea4a)) + - Merge branch `dyn`ification ([`f658fcc`](https://github.com/Byron/gitoxide/commit/f658fcc52dc2200ae34ca53dc10be97fb9012057)) + - Use `dyn` trait where possible. ([`072ee32`](https://github.com/Byron/gitoxide/commit/072ee32f693a31161cd6a843da6582d13efbb20b)) + - Merge branch 'improvements' ([`8a7c2af`](https://github.com/Byron/gitoxide/commit/8a7c2af0d302d5acc87ef2d432bd6870017af63e)) + - Make it easier to access the value of `StateRef`. ([`7df8cf3`](https://github.com/Byron/gitoxide/commit/7df8cf31f794ae75868c606329a5685d198b0f59)) + - Merge branch 'gix-submodule' ([`363ee77`](https://github.com/Byron/gitoxide/commit/363ee77400805f473c9ad66eadad9214e7ab66f4)) +</details> + +## 0.17.0 (2023-08-22) + +<csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> + +### Chore + + - <csr-id-229bd4899213f749a7cc124aa2b82a1368fba40f/> don't call crate 'WIP' in manifest anymore. + +### New Features + + - <csr-id-6892999822008341ae3e6ef97b94ba2fedd4a800/> `search::Outcome::copy_into()` can now copy values from a previous search. + This allows to perform a search once, finding all attributes, and + then copy the results over to another outcome, typically one with + selected attributes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 11 commits contributed to the release over the course of 18 calendar days. + - 30 days passed between releases. + - 2 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** + - Release gix-date v0.7.3, gix-hash v0.12.0, gix-features v0.33.0, gix-actor v0.25.0, gix-object v0.35.0, gix-path v0.9.0, gix-glob v0.11.0, gix-quote v0.4.7, gix-attributes v0.17.0, gix-command v0.2.9, gix-packetline-blocking v0.16.5, gix-filter v0.3.0, gix-fs v0.5.0, gix-commitgraph v0.19.0, gix-hashtable v0.3.0, gix-revwalk v0.6.0, gix-traverse v0.31.0, gix-worktree-stream v0.3.0, gix-archive v0.3.0, gix-config-value v0.13.0, gix-tempfile v8.0.0, gix-lock v8.0.0, gix-ref v0.35.0, gix-sec v0.9.0, gix-config v0.28.0, gix-prompt v0.6.0, gix-url v0.22.0, gix-credentials v0.18.0, gix-diff v0.34.0, gix-discover v0.23.0, gix-ignore v0.6.0, gix-bitmap v0.2.7, gix-index v0.22.0, gix-mailmap v0.17.0, gix-negotiate v0.6.0, gix-pack v0.41.0, gix-odb v0.51.0, gix-pathspec v0.1.0, gix-packetline v0.16.5, gix-transport v0.35.0, gix-protocol v0.38.0, gix-revision v0.20.0, gix-refspec v0.16.0, gix-submodule v0.2.0, gix-worktree v0.24.0, gix-worktree-state v0.1.0, gix v0.52.0, gitoxide-core v0.31.0, gitoxide v0.29.0, safety bump 41 crates ([`30b2761`](https://github.com/Byron/gitoxide/commit/30b27615047692d3ced1b2d9c2ac15a80f79fbee)) + - Update changelogs prior to release ([`f23ea88`](https://github.com/Byron/gitoxide/commit/f23ea8828f2d9ba7559973daca388c9591bcc5fc)) + - Don't call crate 'WIP' in manifest anymore. ([`229bd48`](https://github.com/Byron/gitoxide/commit/229bd4899213f749a7cc124aa2b82a1368fba40f)) + - Merge branch 'pathspec-matching' ([`9f4dfe0`](https://github.com/Byron/gitoxide/commit/9f4dfe0f0b948280692916b596923959ea2fd9da)) + - `search::Outcome::copy_into()` can now copy values from a previous search. ([`6892999`](https://github.com/Byron/gitoxide/commit/6892999822008341ae3e6ef97b94ba2fedd4a800)) + - Add `Debug` to `search::Outcome` ([`72df372`](https://github.com/Byron/gitoxide/commit/72df372f1f53d54e9b3c644e86438cf7e2b9a05e)) + - Adapt to changes in `gix-glob` ([`f564fed`](https://github.com/Byron/gitoxide/commit/f564fedb0d047c71af0f093b41c2afcc63723910)) + - Adapt to changes in `gix-glob` ([`a943647`](https://github.com/Byron/gitoxide/commit/a9436472a9ef880adc8b47e2da221d42a783f89f)) + - Release gix-glob v0.10.2, gix-date v0.7.2, gix-validate v0.8.0, gix-object v0.34.0, gix-ref v0.34.0, gix-config v0.27.0, gix-commitgraph v0.18.2, gix-revwalk v0.5.0, gix-revision v0.19.0, gix-refspec v0.15.0, gix-submodule v0.1.0, safety bump 18 crates ([`4604f83`](https://github.com/Byron/gitoxide/commit/4604f83ef238dc07c85aaeae097399b67f3cfd0c)) + - Merge branch 'dev-on-linux' ([`6b4a303`](https://github.com/Byron/gitoxide/commit/6b4a30330fe49fc97daa73f55bf56580cc0597aa)) + - Fix various tests to run properly on linux ([`ef8ccd9`](https://github.com/Byron/gitoxide/commit/ef8ccd9d16143d37155d063747c69cade80f162d)) +</details> + +## 0.16.0 (2023-07-22) + +### Bug Fixes (BREAKING) + + - <csr-id-0634d543dacc9b3ce3d39938b116a890bcb0686f/> make information about whether or not the matched item is a directory available. + This is important for matching, even though it works differently than excludes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 7 commits contributed to the release over the course of 1 calendar day. + - 3 days passed between releases. + - 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 gix-features v0.32.1, gix-actor v0.24.1, gix-validate v0.7.7, gix-object v0.33.1, gix-path v0.8.4, gix-glob v0.10.1, gix-quote v0.4.6, gix-attributes v0.16.0, gix-command v0.2.8, gix-packetline-blocking v0.16.4, gix-filter v0.2.0, gix-fs v0.4.1, gix-chunk v0.4.4, gix-commitgraph v0.18.1, gix-hashtable v0.2.4, gix-revwalk v0.4.1, gix-traverse v0.30.1, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.5, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.1, gix-sec v0.8.4, gix-prompt v0.5.4, gix-url v0.21.1, gix-credentials v0.17.1, gix-diff v0.33.1, gix-discover v0.22.1, gix-ignore v0.5.1, gix-bitmap v0.2.6, gix-index v0.21.1, gix-mailmap v0.16.1, gix-negotiate v0.5.1, gix-pack v0.40.1, gix-odb v0.50.1, gix-packetline v0.16.4, gix-transport v0.34.1, gix-protocol v0.36.1, gix-revision v0.18.1, gix-refspec v0.14.1, gix-worktree v0.23.0, gix v0.50.0, safety bump 5 crates ([`16295b5`](https://github.com/Byron/gitoxide/commit/16295b58e2581d2e8b8b762816f52baabe871c75)) + - Prepare more changelogs ([`c4cc5f2`](https://github.com/Byron/gitoxide/commit/c4cc5f261d29f712a101033a18293a97a9d4ae85)) + - Release gix-date v0.7.1, gix-hash v0.11.4, gix-trace v0.1.3, gix-features v0.32.0, gix-actor v0.24.0, gix-validate v0.7.7, gix-object v0.33.0, gix-path v0.8.4, gix-glob v0.10.0, gix-quote v0.4.6, gix-attributes v0.15.0, gix-command v0.2.7, gix-packetline-blocking v0.16.3, gix-filter v0.1.0, gix-fs v0.4.0, gix-chunk v0.4.4, gix-commitgraph v0.18.0, gix-hashtable v0.2.4, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.4, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.0, gix-sec v0.8.4, gix-prompt v0.5.3, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-ignore v0.5.0, gix-bitmap v0.2.6, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-packetline v0.16.4, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.1 ([`5cb3589`](https://github.com/Byron/gitoxide/commit/5cb3589b74fc5376e02cbfe151e71344e1c417fe)) + - Update changelogs prior to release ([`2fc66b5`](https://github.com/Byron/gitoxide/commit/2fc66b55097ed494b72d1af939ba5561f71fde97)) + - Merge branch 'gix-archive' ([`1dda48b`](https://github.com/Byron/gitoxide/commit/1dda48ba2fccb93ebac00fe3460e923af43c86ce)) + - Make information about whether or not the matched item is a directory available. ([`0634d54`](https://github.com/Byron/gitoxide/commit/0634d543dacc9b3ce3d39938b116a890bcb0686f)) + - Update license field following SPDX 2.1 license expression standard ([`9064ea3`](https://github.com/Byron/gitoxide/commit/9064ea31fae4dc59a56bdd3a06c0ddc990ee689e)) +</details> + +## 0.15.0 (2023-07-19) + +### Bug Fixes (BREAKING) + + - <csr-id-0634d543dacc9b3ce3d39938b116a890bcb0686f/> make information about whether or not the matched item is a directory available. + This is important for matching, even though it works differently than excludes. + +### Bug Fixes + + - <csr-id-8a361b46bc84428af88e5adc10a53b23bac41edf/> make sure that `search::Outcome` initialized with a selection works. + Previously, the selection might not have been applied if it wasn't created + after the respective attributes were loaded already. + + Now such an update happens during initialization (and efficiently so) so that + there are no surprises. + + Also, implement `Clone` for more types where possible and for convenience. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 5 commits contributed to the release over the course of 12 calendar days. + - 19 days passed between releases. + - 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 gix-features v0.32.0, gix-actor v0.24.0, gix-glob v0.10.0, gix-attributes v0.15.0, gix-commitgraph v0.18.0, gix-config-value v0.12.4, gix-fs v0.4.0, gix-object v0.33.0, gix-ref v0.33.0, gix-config v0.26.0, gix-command v0.2.7, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-filter v0.1.0, gix-ignore v0.5.0, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.0 ([`68ae3ff`](https://github.com/Byron/gitoxide/commit/68ae3ff9d642ec56f088a6a682a073dc16f4e8ca)) + - Adjust package versions (by cargo-smart-release) ([`c70e54f`](https://github.com/Byron/gitoxide/commit/c70e54f163c312c87753a506eeaad462e8579bfb)) + - Prepare changelogs prior to release ([`e4dded0`](https://github.com/Byron/gitoxide/commit/e4dded05138562f9737a7dcfb60570c55769486d)) + - Merge branch 'integrate-filtering' ([`b19a56d`](https://github.com/Byron/gitoxide/commit/b19a56dcfa9bea86332a84aa4e8fad445e7d1724)) + - Make sure that `search::Outcome` initialized with a selection works. ([`8a361b4`](https://github.com/Byron/gitoxide/commit/8a361b46bc84428af88e5adc10a53b23bac41edf)) +</details> + +## 0.14.1 (2023-06-29) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release. + - 6 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** + - Release gix-glob v0.9.1, gix-attributes v0.14.1, gix-config-value v0.12.3, gix-ref v0.32.1, gix-sec v0.8.3, gix-config v0.25.1, gix-url v0.20.1, gix-credentials v0.16.1, gix-discover v0.21.1, gix-ignore v0.4.1, gix-pack v0.39.1, gix-odb v0.49.1, gix-worktree v0.21.1, gix v0.48.0 ([`69c6a36`](https://github.com/Byron/gitoxide/commit/69c6a36ba14cbef129deebda9fd8870005fefa17)) + - Prepare changelogs prior to release ([`c143cf4`](https://github.com/Byron/gitoxide/commit/c143cf48ee1885467e3e9262a3f8823a1247bfe0)) + - Align usage of `gix-path` across all crates ([`73c1292`](https://github.com/Byron/gitoxide/commit/73c1292be393986c4a1adde1400abf551e850da0)) +</details> + +## 0.14.0 (2023-06-22) + +<csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> + +### Chore + + - <csr-id-bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d/> Add `clippy::redundant-closure-for-method-calls` lint + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 6 commits contributed to the release over the course of 10 calendar days. + - 12 days passed between releases. + - 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 gix-date v0.6.0, gix-hash v0.11.3, gix-trace v0.1.1, gix-features v0.31.0, gix-actor v0.22.0, gix-path v0.8.2, gix-glob v0.9.0, gix-quote v0.4.5, gix-attributes v0.14.0, gix-chunk v0.4.3, gix-commitgraph v0.17.0, gix-config-value v0.12.2, gix-fs v0.3.0, gix-tempfile v7.0.0, gix-utils v0.1.3, gix-lock v7.0.0, gix-validate v0.7.6, gix-object v0.31.0, gix-ref v0.31.0, gix-sec v0.8.2, gix-config v0.24.0, gix-command v0.2.6, gix-prompt v0.5.2, gix-url v0.20.0, gix-credentials v0.16.0, gix-diff v0.31.0, gix-discover v0.20.0, gix-hashtable v0.2.2, gix-ignore v0.4.0, gix-bitmap v0.2.5, gix-revwalk v0.2.0, gix-traverse v0.28.0, gix-index v0.19.0, gix-mailmap v0.14.0, gix-negotiate v0.3.0, gix-pack v0.38.0, gix-odb v0.48.0, gix-packetline v0.16.3, gix-transport v0.33.0, gix-protocol v0.34.0, gix-revision v0.16.0, gix-refspec v0.12.0, gix-worktree v0.20.0, gix v0.47.0, gitoxide-core v0.29.0, gitoxide v0.27.0, safety bump 30 crates ([`ea9f942`](https://github.com/Byron/gitoxide/commit/ea9f9424e777f10da0e33bb9ffbbefd01c4c5a74)) + - Prepare changelogs prior to release ([`18b0a37`](https://github.com/Byron/gitoxide/commit/18b0a371941aa2d4d62512437d5daa351ba99ffd)) + - Merge branch 'corpus' ([`aa16c8c`](https://github.com/Byron/gitoxide/commit/aa16c8ce91452a3e3063cf1cf0240b6014c4743f)) + - Change MSRV to 1.65 ([`4f635fc`](https://github.com/Byron/gitoxide/commit/4f635fc4429350bae2582d25de86429969d28f30)) + - Merge branch 'help-874-redundant-closures' ([`fe59956`](https://github.com/Byron/gitoxide/commit/fe59956ad667303a923d7cfd9ffd72283df41d78)) + - Add `clippy::redundant-closure-for-method-calls` lint ([`bcad5c2`](https://github.com/Byron/gitoxide/commit/bcad5c22049d56a25ef69d6c7a3344e78f9a1d4d)) +</details> + ## 0.13.1 (2023-06-10) ### New Features @@ -16,7 +257,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 3 commits contributed to the release. + - 4 commits contributed to the release. - 3 days passed between releases. - 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -28,6 +269,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <details><summary>view details</summary> * **Uncategorized** + - Release gix-attributes v0.13.1, gix-diff v0.30.1, gix-revwalk v0.1.0, gix-traverse v0.27.0, gix-index v0.18.0, gix-revision v0.15.2, gix-negotiate v0.2.1, gix-pack v0.37.0, gix-odb v0.47.0, gix-protocol v0.33.2, gix-worktree v0.19.0, gix v0.46.0, safety bump 7 crates ([`2560a2c`](https://github.com/Byron/gitoxide/commit/2560a2cc3e1d8c60cd812e15696fa4761d036e19)) - Prepare changelogs prior to release ([`298f3d7`](https://github.com/Byron/gitoxide/commit/298f3d7359c5b183314d8c584e45dcdd559d88b3)) - Merge branch 'walk-with-commitgraph' ([`fdee9a2`](https://github.com/Byron/gitoxide/commit/fdee9a22873a13ae644d3dc92f8fe93f8f0266c0)) - Add `StateRef::is_set()` and `StateRef::is_unset()` for convenience(). ([`b061df8`](https://github.com/Byron/gitoxide/commit/b061df82b88b1fa3670240ffc85220ef97b9d892)) diff --git a/vendor/gix-attributes/Cargo.toml b/vendor/gix-attributes/Cargo.toml index 41be8d6bf..08fd832c2 100644 --- a/vendor/gix-attributes/Cargo.toml +++ b/vendor/gix-attributes/Cargo.toml @@ -11,17 +11,17 @@ [package] edition = "2021" -rust-version = "1.64" +rust-version = "1.65" name = "gix-attributes" -version = "0.13.1" +version = "0.19.0" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = [ "src/**/*", "LICENSE-*", "CHANGELOG.md", ] -description = "A WIP crate of the gitoxide project dealing .gitattributes files" -license = "MIT/Apache-2.0" +description = "A crate of the gitoxide project dealing .gitattributes files" +license = "MIT OR Apache-2.0" repository = "https://github.com/Byron/gitoxide" [package.metadata.docs.rs] @@ -43,24 +43,24 @@ features = [ ] default-features = false +[dependencies.byteyarn] +version = "0.2.3" + [dependencies.document-features] version = "0.2.1" optional = true [dependencies.gix-glob] -version = "^0.8.0" +version = "^0.13.0" [dependencies.gix-path] -version = "^0.8.1" +version = "^0.10.0" [dependencies.gix-quote] -version = "^0.4.4" - -[dependencies.kstring] -version = "2.0.0" +version = "^0.4.7" -[dependencies.log] -version = "0.4.17" +[dependencies.gix-trace] +version = "^0.1.3" [dependencies.serde] version = "1.0.114" @@ -84,5 +84,4 @@ serde = [ "dep:serde", "bstr/serde", "gix-glob/serde", - "kstring/serde", ] diff --git a/vendor/gix-attributes/src/lib.rs b/vendor/gix-attributes/src/lib.rs index 7eaac4282..c45b8f9f3 100644 --- a/vendor/gix-attributes/src/lib.rs +++ b/vendor/gix-attributes/src/lib.rs @@ -8,8 +8,8 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![deny(missing_docs, rust_2018_idioms, unsafe_code)] +use byteyarn::{Yarn, YarnRef}; pub use gix_glob as glob; -use kstring::{KString, KStringRef}; mod assignment; /// @@ -34,7 +34,6 @@ pub fn parse(bytes: &[u8]) -> parse::Lines<'_> { /// /// Note that this doesn't contain the name. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum StateRef<'a> { /// The attribute is listed, or has the special value 'true' Set, @@ -42,7 +41,6 @@ pub enum StateRef<'a> { Unset, /// The attribute is set to the given value, which followed the `=` sign. /// Note that values can be empty. - #[cfg_attr(feature = "serde", serde(borrow))] Value(state::ValueRef<'a>), /// The attribute isn't mentioned with a given path or is explicitly set to `Unspecified` using the `!` sign. Unspecified, @@ -52,7 +50,6 @@ pub enum StateRef<'a> { /// /// Note that this doesn't contain the name. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum State { /// The attribute is listed, or has the special value 'true' Set, @@ -67,16 +64,14 @@ pub enum State { /// Represents a validated attribute name #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct Name(pub(crate) KString); +pub struct Name(pub(crate) Yarn); /// Holds a validated attribute name as a reference #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, Ord, PartialOrd)] -pub struct NameRef<'a>(KStringRef<'a>); +pub struct NameRef<'a>(YarnRef<'a, str>); /// Name an attribute and describe it's assigned state. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Assignment { /// The validated name of the attribute. pub name: Name, diff --git a/vendor/gix-attributes/src/name.rs b/vendor/gix-attributes/src/name.rs index 40d86fd4c..43a78bddb 100644 --- a/vendor/gix-attributes/src/name.rs +++ b/vendor/gix-attributes/src/name.rs @@ -1,12 +1,16 @@ use bstr::{BStr, BString, ByteSlice}; -use kstring::KStringRef; +use byteyarn::YarnRef; use crate::{Name, NameRef}; impl<'a> NameRef<'a> { /// Turn this ref into its owned counterpart. pub fn to_owned(self) -> Name { - Name(self.0.into()) + Name( + self.0 + .immortalize() + .map_or_else(|| self.0.to_boxed_str().into(), YarnRef::to_box), + ) } /// Return the inner `str`. @@ -35,7 +39,7 @@ impl<'a> TryFrom<&'a BStr> for NameRef<'a> { } attr_valid(attr) - .then(|| NameRef(KStringRef::from_ref(attr.to_str().expect("no illformed utf8")))) + .then(|| NameRef(YarnRef::from(attr.to_str().expect("no illformed utf8")))) .ok_or_else(|| Error { attribute: attr.into() }) } } diff --git a/vendor/gix-attributes/src/parse.rs b/vendor/gix-attributes/src/parse.rs index 2d90a006d..7d8d6277a 100644 --- a/vendor/gix-attributes/src/parse.rs +++ b/vendor/gix-attributes/src/parse.rs @@ -1,13 +1,12 @@ use std::borrow::Cow; use bstr::{BStr, ByteSlice}; -use kstring::KStringRef; +use byteyarn::YarnRef; use crate::{name, AssignmentRef, Name, NameRef, StateRef}; /// The kind of attribute that was parsed. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Kind { /// A pattern to match paths against Pattern(gix_glob::Pattern), @@ -76,7 +75,7 @@ fn check_attr(attr: &BStr) -> Result<NameRef<'_>, name::Error> { } attr_valid(attr) - .then(|| NameRef(KStringRef::from_ref(attr.to_str().expect("no illformed utf8")))) + .then(|| NameRef(YarnRef::from(attr.to_str().expect("no illformed utf8")))) .ok_or_else(|| name::Error { attribute: attr.into() }) } diff --git a/vendor/gix-attributes/src/search/attributes.rs b/vendor/gix-attributes/src/search/attributes.rs index 078c187bb..88cc8356c 100644 --- a/vendor/gix-attributes/src/search/attributes.rs +++ b/vendor/gix-attributes/src/search/attributes.rs @@ -27,14 +27,14 @@ impl Search { let mut group = Self::default(); group.add_patterns_buffer( b"[attr]binary -diff -merge -text", - "[builtin]", + "[builtin]".into(), None, collection, true, /* allow macros */ ); for path in files.into_iter() { - group.add_patterns_file(path, true, None, buf, collection, true /* allow macros */)?; + group.add_patterns_file(path.into(), true, None, buf, collection, true /* allow macros */)?; } Ok(group) } @@ -49,7 +49,7 @@ impl Search { /// Returns `true` if the file was added, or `false` if it didn't exist. pub fn add_patterns_file( &mut self, - source: impl Into<PathBuf>, + source: PathBuf, follow_symlinks: bool, root: Option<&Path>, buf: &mut Vec<u8>, @@ -75,7 +75,7 @@ impl Search { pub fn add_patterns_buffer( &mut self, bytes: &[u8], - source: impl Into<PathBuf>, + source: PathBuf, root: Option<&Path>, collection: &mut MetadataCollection, allow_macros: bool, @@ -99,17 +99,17 @@ impl Search { impl Search { /// Match `relative_path`, a path relative to the repository, while respective `case`-sensitivity and write them to `out` /// Return `true` if at least one pattern matched. - pub fn pattern_matching_relative_path<'a, 'b>( - &'a self, - relative_path: impl Into<&'b BStr>, + pub fn pattern_matching_relative_path( + &self, + relative_path: &BStr, case: gix_glob::pattern::Case, + is_dir: Option<bool>, out: &mut Outcome, ) -> bool { - let relative_path = relative_path.into(); let basename_pos = relative_path.rfind(b"/").map(|p| p + 1); let mut has_match = false; self.patterns.iter().rev().any(|pl| { - has_match |= pattern_matching_relative_path(pl, relative_path, basename_pos, case, out); + has_match |= pattern_matching_relative_path(pl, relative_path, basename_pos, case, is_dir, out); out.is_done() }); has_match @@ -124,7 +124,7 @@ impl Search { impl Pattern for Attributes { type Value = Value; - fn bytes_to_patterns(bytes: &[u8], source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> { + fn bytes_to_patterns(bytes: &[u8], _source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> { fn into_owned_assignments<'a>( attrs: impl Iterator<Item = Result<crate::AssignmentRef<'a>, crate::name::Error>>, ) -> Option<Assignments> { @@ -138,8 +138,8 @@ impl Pattern for Attributes { .collect::<Result<Assignments, _>>(); match res { Ok(res) => Some(res), - Err(err) => { - log::warn!("{}", err); + Err(_err) => { + gix_trace::warn!("{}", _err); None } } @@ -148,8 +148,8 @@ impl Pattern for Attributes { crate::parse(bytes) .filter_map(|res| match res { Ok(pattern) => Some(pattern), - Err(err) => { - log::warn!("{}: {}", source.display(), err); + Err(_err) => { + gix_trace::warn!("{}: {}", _source.display(), _err); None } }) @@ -180,7 +180,9 @@ impl Pattern for Attributes { }) .collect() } +} +impl Attributes { fn may_use_glob_pattern(pattern: &gix_glob::Pattern) -> bool { pattern.mode != macro_mode() } @@ -201,6 +203,7 @@ fn pattern_matching_relative_path( relative_path: &BStr, basename_pos: Option<usize>, case: gix_glob::pattern::Case, + is_dir: Option<bool>, out: &mut Outcome, ) -> bool { let (relative_path, basename_start_pos) = @@ -227,7 +230,13 @@ fn pattern_matching_relative_path( Value::Assignments(attrs) => attrs, }; if out.has_unspecified_attributes(attrs.iter().map(|attr| attr.id)) - && pattern.matches_repo_relative_path(relative_path, basename_start_pos, None, case) + && pattern.matches_repo_relative_path( + relative_path, + basename_start_pos, + is_dir, + case, + gix_glob::wildmatch::Mode::NO_MATCH_SLASH_LITERAL, + ) { let all_filled = out.fill_attributes(attrs.iter(), pattern, list.source.as_ref(), *sequence_number); if all_filled { diff --git a/vendor/gix-attributes/src/search/mod.rs b/vendor/gix-attributes/src/search/mod.rs index e70c3b8b1..f06928bf2 100644 --- a/vendor/gix-attributes/src/search/mod.rs +++ b/vendor/gix-attributes/src/search/mod.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use kstring::KString; +use byteyarn::Yarn; use smallvec::SmallVec; use crate::{Assignment, AssignmentRef}; @@ -89,7 +89,7 @@ pub enum MatchKind { } /// The result of a search, containing all matching attributes. -#[derive(Default)] +#[derive(Default, Clone)] pub struct Outcome { /// The list of all available attributes, by ascending order. Each slots index corresponds to an attribute with that order, i.e. /// `arr[attr.id] = <attr info>`. @@ -99,7 +99,7 @@ pub struct Outcome { /// A stack of attributes to use for processing attributes of matched patterns and for resolving their macros. attrs_stack: SmallVec<[(AttributeId, Assignment, Option<AttributeId>); 8]>, /// A set of attributes we should limit ourselves to, or empty if we should fill in all attributes, made of - selected: SmallVec<[(KString, Option<AttributeId>); AVERAGE_NUM_ATTRS]>, + selected: SmallVec<[(Yarn, Option<AttributeId>); AVERAGE_NUM_ATTRS]>, /// storage for all patterns we have matched so far (in order to avoid referencing them, we copy them, but only once). patterns: RefMap<gix_glob::Pattern>, /// storage for all assignments we have matched so far (in order to avoid referencing them, we copy them, but only once). @@ -135,7 +135,7 @@ pub struct MetadataCollection { /// A mapping of an attribute or macro name to its order, that is the time when it was *first* seen. /// /// This is the inverse of the order attributes are searched. - name_to_meta: HashMap<KString, Metadata>, + name_to_meta: HashMap<Yarn, Metadata>, } /// Metadata associated with an attribute or macro name. diff --git a/vendor/gix-attributes/src/search/outcome.rs b/vendor/gix-attributes/src/search/outcome.rs index 469cae154..9ad8a81e1 100644 --- a/vendor/gix-attributes/src/search/outcome.rs +++ b/vendor/gix-attributes/src/search/outcome.rs @@ -1,6 +1,6 @@ use bstr::{BString, ByteSlice}; +use byteyarn::Yarn; use gix_glob::Pattern; -use kstring::{KString, KStringRef}; use crate::{ search::{ @@ -28,6 +28,10 @@ impl Outcome { }) { self.matches_by_id[order].macro_attributes = macro_attributes.clone() } + + for (name, id) in self.selected.iter_mut().filter(|(_, id)| id.is_none()) { + *id = collection.name_to_meta.get(name.as_str()).map(|meta| meta.id) + } } self.reset(); } @@ -40,16 +44,23 @@ impl Outcome { pub fn initialize_with_selection<'a>( &mut self, collection: &MetadataCollection, - attribute_names: impl IntoIterator<Item = impl Into<KStringRef<'a>>>, + attribute_names: impl IntoIterator<Item = impl Into<&'a str>>, + ) { + self.initialize_with_selection_inner(collection, &mut attribute_names.into_iter().map(Into::into)) + } + + fn initialize_with_selection_inner( + &mut self, + collection: &MetadataCollection, + attribute_names: &mut dyn Iterator<Item = &str>, ) { self.initialize(collection); self.selected.clear(); - self.selected.extend(attribute_names.into_iter().map(|name| { - let name = name.into(); + self.selected.extend(attribute_names.map(|name| { ( - name.to_owned(), - collection.name_to_meta.get(name.as_str()).map(|meta| meta.id), + Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()), + collection.name_to_meta.get(name).map(|meta| meta.id), ) })); self.reset_remaining(); @@ -69,6 +80,26 @@ impl Outcome { self.selected.iter().filter(|(_name, id)| id.is_some()).count() }); } + + /// A performance optimization which allows results from this instance to be efficiently copied over to `dest`. + /// For this to work, `collection` must be the one used to initialize our state, and `dest` should not have been initialized + /// with any meaningful collection initially, i.e. be empty the first time this method is called. + /// + /// Note that it's safe to call it multiple times, so that it can be called after this instance was used to store a search result. + pub fn copy_into(&self, collection: &MetadataCollection, dest: &mut Self) { + dest.initialize(collection); + dest.matches_by_id = self.matches_by_id.clone(); + if dest.patterns.len() != self.patterns.len() { + dest.patterns = self.patterns.clone(); + } + if dest.assignments.len() != self.assignments.len() { + dest.assignments = self.assignments.clone(); + } + if dest.source_paths.len() != self.source_paths.len() { + dest.source_paths = self.source_paths.clone(); + } + dest.remaining = self.remaining; + } } /// Access @@ -219,6 +250,29 @@ impl Outcome { } } +impl std::fmt::Debug for Outcome { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + struct AsDisplay<'a>(&'a dyn std::fmt::Display); + impl std::fmt::Debug for AsDisplay<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } + } + + let mut dbg = f.debug_tuple("Outcome"); + if self.selected.is_empty() { + for match_ in self.iter() { + dbg.field(&AsDisplay(&match_.assignment)); + } + } else { + for match_ in self.iter_selected() { + dbg.field(&AsDisplay(&match_.assignment)); + } + } + dbg.finish() + } +} + /// Mutation impl MetadataCollection { /// Assign order ids to each attribute either in macros (along with macros themselves) or attributes of patterns, and store @@ -261,7 +315,7 @@ impl MetadataCollection { None => { let order = AttributeId(self.name_to_meta.len()); self.name_to_meta.insert( - KString::from_ref(name), + Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()), Metadata { id: order, macro_attributes: Default::default(), @@ -281,7 +335,10 @@ impl MetadataCollection { Some(meta) => meta.id, None => { let order = AttributeId(self.name_to_meta.len()); - self.name_to_meta.insert(KString::from_ref(name), order.into()); + self.name_to_meta.insert( + Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()), + order.into(), + ); order } } @@ -357,7 +414,7 @@ impl MatchLocation { crate::search::MatchLocation { source: self .source - .and_then(|source| out.source_paths.resolve(source).map(|p| p.as_path())), + .and_then(|source| out.source_paths.resolve(source).map(AsRef::as_ref)), sequence_number: self.sequence_number, } } diff --git a/vendor/gix-attributes/src/search/refmap.rs b/vendor/gix-attributes/src/search/refmap.rs index aa9dee84b..9a44b06da 100644 --- a/vendor/gix-attributes/src/search/refmap.rs +++ b/vendor/gix-attributes/src/search/refmap.rs @@ -8,6 +8,7 @@ use std::{ }; pub(crate) type RefMapKey = u64; +#[derive(Clone)] pub(crate) struct RefMap<T>(BTreeMap<RefMapKey, T>); impl<T> Default for RefMap<T> { @@ -20,6 +21,9 @@ impl<T> RefMap<T> where T: Hash + Clone, { + pub(crate) fn len(&self) -> usize { + self.0.len() + } pub(crate) fn insert(&mut self, value: &T) -> RefMapKey { let mut s = DefaultHasher::new(); value.hash(&mut s); diff --git a/vendor/gix-attributes/src/state.rs b/vendor/gix-attributes/src/state.rs index ffc0bce41..585e05adc 100644 --- a/vendor/gix-attributes/src/state.rs +++ b/vendor/gix-attributes/src/state.rs @@ -1,31 +1,26 @@ use bstr::{BStr, ByteSlice}; -use kstring::{KString, KStringRef}; +use byteyarn::{ByteYarn, YarnRef}; use crate::{State, StateRef}; /// A container to encapsulate a tightly packed and typically unallocated byte value that isn't necessarily UTF8 encoded. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct Value(KString); +pub struct Value(ByteYarn); /// A reference container to encapsulate a tightly packed and typically unallocated byte value that isn't necessarily UTF8 encoded. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ValueRef<'a>(#[cfg_attr(feature = "serde", serde(borrow))] KStringRef<'a>); +pub struct ValueRef<'a>(YarnRef<'a, [u8]>); -/// Conversions +/// Lifecycle impl<'a> ValueRef<'a> { /// Keep `input` as our value. pub fn from_bytes(input: &'a [u8]) -> Self { - Self(KStringRef::from_ref( - // SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such. - #[allow(unsafe_code)] - unsafe { - std::str::from_utf8_unchecked(input) - }, - )) + Self(YarnRef::from(input)) } +} +/// Access and conversions +impl ValueRef<'_> { /// Access this value as byte string. pub fn as_bstr(&self) -> &BStr { self.0.as_bytes().as_bstr() @@ -39,19 +34,25 @@ impl<'a> ValueRef<'a> { impl<'a> From<&'a str> for ValueRef<'a> { fn from(v: &'a str) -> Self { - ValueRef(v.into()) + ValueRef(v.as_bytes().into()) } } impl<'a> From<ValueRef<'a>> for Value { fn from(v: ValueRef<'a>) -> Self { - Value(v.0.into()) + Value( + v.0.immortalize() + .map_or_else(|| v.0.to_boxed_bytes().into(), YarnRef::to_box), + ) } } impl From<&str> for Value { fn from(v: &str) -> Self { - Value(KString::from_ref(v)) + Value( + ByteYarn::inlined(v.as_bytes()) + .unwrap_or_else(|| ByteYarn::from_boxed_bytes(v.as_bytes().to_vec().into_boxed_slice())), + ) } } @@ -79,6 +80,14 @@ impl StateRef<'_> { pub fn is_unset(&self) -> bool { matches!(self, StateRef::Unset) } + + /// Attempt to obtain the string value of this state, or return `None` if there is no such value. + pub fn as_bstr(&self) -> Option<&BStr> { + match self { + StateRef::Value(v) => Some(v.as_bstr()), + _ => None, + } + } } /// Initialization |