From 36e7e3f69636c484c94048bf5f56590a80d4c728 Mon Sep 17 00:00:00 2001 From: KodrAus Date: Mon, 13 Jan 2025 08:25:08 +1000 Subject: [PATCH] revert loosening of kv cargo features --- Cargo.toml | 2 +- src/kv/value.rs | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa51a3ed9..0d668c903 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ release_max_level_info = [] release_max_level_debug = [] release_max_level_trace = [] -std = ["value-bag?/std"] +std = [] kv = [] kv_sval = ["kv", "value-bag/sval", "sval", "sval_ref"] diff --git a/src/kv/value.rs b/src/kv/value.rs index 6616ee961..ef9429832 100644 --- a/src/kv/value.rs +++ b/src/kv/value.rs @@ -385,7 +385,7 @@ impl<'v> Value<'v> { } } -#[cfg(feature = "std")] +#[cfg(feature = "kv_std")] mod std_support { use std::borrow::Cow; use std::rc::Rc; @@ -432,6 +432,13 @@ mod std_support { } } + impl<'v> Value<'v> { + /// Try convert this value into a string. + pub fn to_cow_str(&self) -> Option> { + self.inner.to_str() + } + } + impl<'v> From<&'v String> for Value<'v> { fn from(v: &'v String) -> Self { Value::from(&**v) @@ -439,22 +446,6 @@ mod std_support { } } -#[cfg(all(feature = "std", feature = "value-bag"))] -impl<'v> Value<'v> { - /// Try to convert this value into a string. - pub fn to_cow_str(&self) -> Option> { - self.inner.to_str() - } -} - -#[cfg(all(feature = "std", not(feature = "value-bag")))] -impl<'v> Value<'v> { - /// Try to convert this value into a string. - pub fn to_cow_str(&self) -> Option> { - self.inner.to_borrowed_str().map(std::borrow::Cow::Borrowed) - } -} - /// A visitor for a [`Value`]. /// /// Also see [`Value`'s documentation on seralization]. Value visitors are a simple alternative