-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Labels
Description
That said, with log = { version = "0.4", features = ["std", "kv"] }, we have:
#[cfg(feature = "std")]
mod std_support {
use super::*;
use std::borrow::Cow;
impl ToKey for String {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
impl<'a> ToKey for Cow<'a, str> {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
}But the same for ToValue is filtered out:
#[cfg(feature = "kv_std")]
mod std_support {
use std::borrow::Cow;
use std::rc::Rc;
use std::sync::Arc;
use super::*;
impl<T> ToValue for Box<T>
where
T: ToValue + ?Sized,
{
fn to_value(&self) -> Value {
(**self).to_value()
}
}
impl<T> ToValue for Arc<T>
where
T: ToValue + ?Sized,
{
fn to_value(&self) -> Value {
(**self).to_value()
}
}
impl<T> ToValue for Rc<T>
where
T: ToValue + ?Sized,
{
fn to_value(&self) -> Value {
(**self).to_value()
}
}
impl ToValue for String {
fn to_value(&self) -> Value {
Value::from(&**self)
}
}
impl<'v> ToValue for Cow<'v, str> {
fn to_value(&self) -> Value {
Value::from(&**self)
}
}
impl<'v> Value<'v> {
/// Try convert this value into a string.
pub fn to_cow_str(&self) -> Option<Cow<'v, str>> {
self.inner.to_str()
}
}
impl<'v> From<&'v String> for Value<'v> {
fn from(v: &'v String) -> Self {
Value::from(&**v)
}
}
}I'm willing to send a PR to change the feature gate of ToValue's std_support to "std", but I'd first open an issue to see if anything I missed.