summaryrefslogtreecommitdiffstats
path: root/vendor/gix-attributes
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
commitcec1877e180393eba0f6ddb0cf97bf3a791631c7 (patch)
tree47b4dac2a9dd9a40c30c251b4d4a72d7ccf77e9f /vendor/gix-attributes
parentAdding debian version 1.74.1+dfsg1-1. (diff)
downloadrustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.tar.xz
rustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-attributes')
-rw-r--r--vendor/gix-attributes/.cargo-checksum.json2
-rw-r--r--vendor/gix-attributes/CHANGELOG.md42
-rw-r--r--vendor/gix-attributes/Cargo.toml11
-rw-r--r--vendor/gix-attributes/src/lib.rs11
-rw-r--r--vendor/gix-attributes/src/name.rs10
-rw-r--r--vendor/gix-attributes/src/parse.rs5
-rw-r--r--vendor/gix-attributes/src/search/mod.rs6
-rw-r--r--vendor/gix-attributes/src/search/outcome.rs40
-rw-r--r--vendor/gix-attributes/src/state.rs28
9 files changed, 98 insertions, 57 deletions
diff --git a/vendor/gix-attributes/.cargo-checksum.json b/vendor/gix-attributes/.cargo-checksum.json
index 7a1ce1338..ba3606d66 100644
--- a/vendor/gix-attributes/.cargo-checksum.json
+++ b/vendor/gix-attributes/.cargo-checksum.json
@@ -1 +1 @@
-{"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
+{"files":{"CHANGELOG.md":"eb167b5134cd80e7dde337630af9627b0d8aed558b56836e9e169daacb215403","Cargo.toml":"759f79963bad14135a4be663e3cd160f0f4ad716400ea3027d15728756a2452a","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":"a8ae59f5c34941a8a49dde1c214f67971b397a6b3c8c50b95963ac0b8ca587f3","src/search/mod.rs":"2d33ed41119377c884e5e029eb1593c6950746f2c0cdd739b3fd989eb438835d","src/search/outcome.rs":"cb260a9df1866f9758b8bdef1ecd5449324b1351dff1ca74c64083de68994cc0","src/search/refmap.rs":"08bba1460e70966ea84a2604621ab480b28e3102c75f17033a457cfa132d5f80","src/source.rs":"81092fff85f1f31c8daa1bac313ffd44511c64617e272d4f4225ed714bf89464","src/state.rs":"0551a2a68baa671bde06d2ab8213c8a06ed1dea466132b29efafc803217bd6fe"},"package":"dca120f0c6562d2d7cae467f2466e576d9f7f189beec2af2e026145107c729e2"} \ No newline at end of file
diff --git a/vendor/gix-attributes/CHANGELOG.md b/vendor/gix-attributes/CHANGELOG.md
index fdc678344..fae25cf55 100644
--- a/vendor/gix-attributes/CHANGELOG.md
+++ b/vendor/gix-attributes/CHANGELOG.md
@@ -5,6 +5,45 @@ 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.20.0 (2023-10-12)
+
+### Bug Fixes
+
+ - <csr-id-ac1d8d4a323fc5fb27b8c458f1babb4acc56ca52/> revert 'byteyarn' addition in favor of `kstring`
+ It turns out not to work on certain 32bit targets that `gix` now has to support
+ due to Fedora packaging.
+
+### Commit Statistics
+
+<csr-read-only-do-not-edit/>
+
+ - 6 commits contributed to the release over the course of 10 calendar days.
+ - 17 days passed between releases.
+ - 1 commit was understood as [conventional](https://www.conventionalcommits.org).
+ - 1 unique issue was worked on: [#1050](https://github.com/Byron/gitoxide/issues/1050)
+
+### Thanks Clippy
+
+<csr-read-only-do-not-edit/>
+
+[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
+
+### Commit Details
+
+<csr-read-only-do-not-edit/>
+
+<details><summary>view details</summary>
+
+ * **[#1050](https://github.com/Byron/gitoxide/issues/1050)**
+ - Revert "feat!: Use `yarn` for lower memory footprint and better performance." ([`355fd19`](https://github.com/Byron/gitoxide/commit/355fd191dbdae803c660781603d7986047760471))
+ * **Uncategorized**
+ - Prepare changelogs prior to release ([`1347a54`](https://github.com/Byron/gitoxide/commit/1347a54f84599d8f0aa935d6e64b16c2298d25cf))
+ - Revert 'byteyarn' addition in favor of `kstring` ([`ac1d8d4`](https://github.com/Byron/gitoxide/commit/ac1d8d4a323fc5fb27b8c458f1babb4acc56ca52))
+ - Thanks clippy ([`345712d`](https://github.com/Byron/gitoxide/commit/345712dcdfddcccc630bbfef2ed4f461b21550d3))
+ - Merge branch 'improvements' ([`3939a45`](https://github.com/Byron/gitoxide/commit/3939a455be2269280248cdfed4a5983f8d178141))
+ - Optimize Yarn instantiation ([`82874cd`](https://github.com/Byron/gitoxide/commit/82874cd04d6bb4635016391a43f51fca078195c7))
+</details>
+
## 0.19.0 (2023-09-24)
### New Features (BREAKING)
@@ -16,7 +55,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 over the course of 14 calendar days.
+ - 4 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
@@ -28,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary>
* **Uncategorized**
+ - Release gix-features v0.35.0, gix-actor v0.27.0, gix-object v0.37.0, gix-glob v0.13.0, gix-attributes v0.19.0, gix-filter v0.5.0, gix-fs v0.7.0, gix-commitgraph v0.21.0, gix-revwalk v0.8.0, gix-traverse v0.33.0, gix-worktree-stream v0.5.0, gix-archive v0.5.0, gix-tempfile v10.0.0, gix-lock v10.0.0, gix-ref v0.37.0, gix-config v0.30.0, gix-url v0.24.0, gix-credentials v0.20.0, gix-diff v0.36.0, gix-discover v0.25.0, gix-ignore v0.8.0, gix-index v0.25.0, gix-mailmap v0.19.0, gix-negotiate v0.8.0, gix-pack v0.43.0, gix-odb v0.53.0, gix-pathspec v0.3.0, gix-transport v0.37.0, gix-protocol v0.40.0, gix-revision v0.22.0, gix-refspec v0.18.0, gix-status v0.1.0, gix-submodule v0.4.0, gix-worktree v0.26.0, gix-worktree-state v0.3.0, gix v0.54.0, gitoxide-core v0.32.0, gitoxide v0.30.0, safety bump 37 crates ([`7891fb1`](https://github.com/Byron/gitoxide/commit/7891fb17348ec2f4c997665f9a25be36e2713da4))
- 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))
diff --git a/vendor/gix-attributes/Cargo.toml b/vendor/gix-attributes/Cargo.toml
index 08fd832c2..4e7cf4953 100644
--- a/vendor/gix-attributes/Cargo.toml
+++ b/vendor/gix-attributes/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.65"
name = "gix-attributes"
-version = "0.19.0"
+version = "0.20.0"
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
include = [
"src/**/*",
@@ -43,15 +43,12 @@ features = [
]
default-features = false
-[dependencies.byteyarn]
-version = "0.2.3"
-
[dependencies.document-features]
version = "0.2.1"
optional = true
[dependencies.gix-glob]
-version = "^0.13.0"
+version = "^0.14.0"
[dependencies.gix-path]
version = "^0.10.0"
@@ -62,6 +59,9 @@ version = "^0.4.7"
[dependencies.gix-trace]
version = "^0.1.3"
+[dependencies.kstring]
+version = "2.0.0"
+
[dependencies.serde]
version = "1.0.114"
features = ["derive"]
@@ -84,4 +84,5 @@ 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 c45b8f9f3..7eaac4282 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,6 +34,7 @@ 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,
@@ -41,6 +42,7 @@ 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,
@@ -50,6 +52,7 @@ 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,
@@ -64,14 +67,16 @@ pub enum State {
/// Represents a validated attribute name
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
-pub struct Name(pub(crate) Yarn);
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
+pub struct Name(pub(crate) KString);
/// Holds a validated attribute name as a reference
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, Ord, PartialOrd)]
-pub struct NameRef<'a>(YarnRef<'a, str>);
+pub struct NameRef<'a>(KStringRef<'a>);
/// 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 43a78bddb..40d86fd4c 100644
--- a/vendor/gix-attributes/src/name.rs
+++ b/vendor/gix-attributes/src/name.rs
@@ -1,16 +1,12 @@
use bstr::{BStr, BString, ByteSlice};
-use byteyarn::YarnRef;
+use kstring::KStringRef;
use crate::{Name, NameRef};
impl<'a> NameRef<'a> {
/// Turn this ref into its owned counterpart.
pub fn to_owned(self) -> Name {
- Name(
- self.0
- .immortalize()
- .map_or_else(|| self.0.to_boxed_str().into(), YarnRef::to_box),
- )
+ Name(self.0.into())
}
/// Return the inner `str`.
@@ -39,7 +35,7 @@ impl<'a> TryFrom<&'a BStr> for NameRef<'a> {
}
attr_valid(attr)
- .then(|| NameRef(YarnRef::from(attr.to_str().expect("no illformed utf8"))))
+ .then(|| NameRef(KStringRef::from_ref(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 7d8d6277a..2d90a006d 100644
--- a/vendor/gix-attributes/src/parse.rs
+++ b/vendor/gix-attributes/src/parse.rs
@@ -1,12 +1,13 @@
use std::borrow::Cow;
use bstr::{BStr, ByteSlice};
-use byteyarn::YarnRef;
+use kstring::KStringRef;
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),
@@ -75,7 +76,7 @@ fn check_attr(attr: &BStr) -> Result<NameRef<'_>, name::Error> {
}
attr_valid(attr)
- .then(|| NameRef(YarnRef::from(attr.to_str().expect("no illformed utf8"))))
+ .then(|| NameRef(KStringRef::from_ref(attr.to_str().expect("no illformed utf8"))))
.ok_or_else(|| name::Error { attribute: attr.into() })
}
diff --git a/vendor/gix-attributes/src/search/mod.rs b/vendor/gix-attributes/src/search/mod.rs
index f06928bf2..83c6d4192 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 byteyarn::Yarn;
+use kstring::KString;
use smallvec::SmallVec;
use crate::{Assignment, AssignmentRef};
@@ -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<[(Yarn, Option<AttributeId>); AVERAGE_NUM_ATTRS]>,
+ selected: SmallVec<[(KString, 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<Yarn, Metadata>,
+ name_to_meta: HashMap<KString, 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 9ad8a81e1..7cea3bd19 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::{
@@ -44,7 +44,7 @@ impl Outcome {
pub fn initialize_with_selection<'a>(
&mut self,
collection: &MetadataCollection,
- attribute_names: impl IntoIterator<Item = impl Into<&'a str>>,
+ attribute_names: impl IntoIterator<Item = impl Into<KStringRef<'a>>>,
) {
self.initialize_with_selection_inner(collection, &mut attribute_names.into_iter().map(Into::into))
}
@@ -52,15 +52,15 @@ impl Outcome {
fn initialize_with_selection_inner(
&mut self,
collection: &MetadataCollection,
- attribute_names: &mut dyn Iterator<Item = &str>,
+ attribute_names: &mut dyn Iterator<Item = KStringRef<'_>>,
) {
self.initialize(collection);
self.selected.clear();
self.selected.extend(attribute_names.map(|name| {
(
- Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()),
- collection.name_to_meta.get(name).map(|meta| meta.id),
+ name.to_owned(),
+ collection.name_to_meta.get(name.as_str()).map(|meta| meta.id),
)
}));
self.reset_remaining();
@@ -176,12 +176,11 @@ impl Outcome {
source: Option<&std::path::PathBuf>,
sequence_number: usize,
) -> bool {
- self.attrs_stack.extend(attrs.filter_map(|attr| {
- self.matches_by_id[attr.id.0]
- .r#match
- .is_none()
- .then(|| (attr.id, attr.inner.clone(), None))
- }));
+ self.attrs_stack.extend(
+ attrs
+ .filter(|attr| self.matches_by_id[attr.id.0].r#match.is_none())
+ .map(|attr| (attr.id, attr.inner.clone(), None)),
+ );
while let Some((id, assignment, parent_order)) = self.attrs_stack.pop() {
let slot = &mut self.matches_by_id[id.0];
if slot.r#match.is_some() {
@@ -212,12 +211,12 @@ impl Outcome {
if is_macro {
// TODO(borrowchk): one fine day we should be able to re-borrow `slot` without having to redo the array access.
let slot = &self.matches_by_id[id.0];
- self.attrs_stack.extend(slot.macro_attributes.iter().filter_map(|attr| {
- self.matches_by_id[attr.id.0]
- .r#match
- .is_none()
- .then(|| (attr.id, attr.inner.clone(), Some(id)))
- }));
+ self.attrs_stack.extend(
+ slot.macro_attributes
+ .iter()
+ .filter(|attr| self.matches_by_id[attr.id.0].r#match.is_none())
+ .map(|attr| (attr.id, attr.inner.clone(), Some(id))),
+ );
}
}
false
@@ -315,7 +314,7 @@ impl MetadataCollection {
None => {
let order = AttributeId(self.name_to_meta.len());
self.name_to_meta.insert(
- Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()),
+ KString::from_ref(name),
Metadata {
id: order,
macro_attributes: Default::default(),
@@ -335,10 +334,7 @@ impl MetadataCollection {
Some(meta) => meta.id,
None => {
let order = AttributeId(self.name_to_meta.len());
- self.name_to_meta.insert(
- Yarn::inlined(name).unwrap_or_else(|| name.to_string().into_boxed_str().into()),
- order.into(),
- );
+ self.name_to_meta.insert(KString::from_ref(name), order.into());
order
}
}
diff --git a/vendor/gix-attributes/src/state.rs b/vendor/gix-attributes/src/state.rs
index 585e05adc..80ebcfead 100644
--- a/vendor/gix-attributes/src/state.rs
+++ b/vendor/gix-attributes/src/state.rs
@@ -1,21 +1,29 @@
use bstr::{BStr, ByteSlice};
-use byteyarn::{ByteYarn, YarnRef};
+use kstring::{KString, KStringRef};
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)]
-pub struct Value(ByteYarn);
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
+pub struct Value(KString);
/// 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)]
-pub struct ValueRef<'a>(YarnRef<'a, [u8]>);
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
+pub struct ValueRef<'a>(#[cfg_attr(feature = "serde", serde(borrow))] KStringRef<'a>);
/// Lifecycle
impl<'a> ValueRef<'a> {
/// Keep `input` as our value.
pub fn from_bytes(input: &'a [u8]) -> Self {
- Self(YarnRef::from(input))
+ 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)
+ },
+ ))
}
}
@@ -34,25 +42,19 @@ impl ValueRef<'_> {
impl<'a> From<&'a str> for ValueRef<'a> {
fn from(v: &'a str) -> Self {
- ValueRef(v.as_bytes().into())
+ ValueRef(v.into())
}
}
impl<'a> From<ValueRef<'a>> for Value {
fn from(v: ValueRef<'a>) -> Self {
- Value(
- v.0.immortalize()
- .map_or_else(|| v.0.to_boxed_bytes().into(), YarnRef::to_box),
- )
+ Value(v.0.into())
}
}
impl From<&str> for Value {
fn from(v: &str) -> Self {
- Value(
- ByteYarn::inlined(v.as_bytes())
- .unwrap_or_else(|| ByteYarn::from_boxed_bytes(v.as_bytes().to_vec().into_boxed_slice())),
- )
+ Value(KString::from_ref(v))
}
}