mirror of
https://github.com/openharmony/third_party_rust_log.git
synced 2026-07-01 05:35:43 -04:00
upgrade to value-bag 1.0.0-alpha.9 and remove by-value 128bit int conversions
This commit is contained in:
+2
-2
@@ -56,11 +56,11 @@ kv_unstable_serde = ["kv_unstable_std", "value-bag/serde", "serde"]
|
||||
cfg-if = "1.0"
|
||||
serde = { version = "1.0", optional = true, default-features = false }
|
||||
sval = { version = "=1.0.0-alpha.5", optional = true, default-features = false }
|
||||
value-bag = { version = "=1.0.0-alpha.8", optional = true, default-features = false }
|
||||
value-bag = { version = "=1.0.0-alpha.9", optional = true, default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
rustversion = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_test = "1.0"
|
||||
sval = { version = "=1.0.0-alpha.5", features = ["derive"] }
|
||||
value-bag = { version = "=1.0.0-alpha.8", features = ["test"] }
|
||||
value-bag = { version = "=1.0.0-alpha.9", features = ["test"] }
|
||||
|
||||
+53
-5
@@ -441,12 +441,60 @@ impl ToValue for str {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for u128 {
|
||||
fn to_value(&self) -> Value {
|
||||
Value::from(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for i128 {
|
||||
fn to_value(&self) -> Value {
|
||||
Value::from(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for std::num::NonZeroU128 {
|
||||
fn to_value(&self) -> Value {
|
||||
Value::from(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for std::num::NonZeroI128 {
|
||||
fn to_value(&self) -> Value {
|
||||
Value::from(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> From<&'v str> for Value<'v> {
|
||||
fn from(value: &'v str) -> Self {
|
||||
Value::from_value_bag(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> From<&'v u128> for Value<'v> {
|
||||
fn from(value: &'v u128) -> Self {
|
||||
Value::from_value_bag(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> From<&'v i128> for Value<'v> {
|
||||
fn from(value: &'v i128) -> Self {
|
||||
Value::from_value_bag(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> From<&'v std::num::NonZeroU128> for Value<'v> {
|
||||
fn from(v: &'v std::num::NonZeroU128) -> Value<'v> {
|
||||
Value::from_value_bag(unsafe { std::mem::transmute::<&std::num::NonZeroU128, &u128>(v) })
|
||||
}
|
||||
}
|
||||
|
||||
impl<'v> From<&'v std::num::NonZeroI128> for Value<'v> {
|
||||
fn from(v: &'v std::num::NonZeroI128) -> Value<'v> {
|
||||
Value::from_value_bag(unsafe { std::mem::transmute::<&std::num::NonZeroI128, &i128>(v) })
|
||||
}
|
||||
}
|
||||
|
||||
impl ToValue for () {
|
||||
fn to_value(&self) -> Value {
|
||||
Value::from_value_bag(())
|
||||
@@ -515,13 +563,13 @@ macro_rules! impl_value_to_primitive {
|
||||
}
|
||||
|
||||
impl_to_value_primitive![
|
||||
usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64, char, bool,
|
||||
usize, u8, u16, u32, u64, isize, i8, i16, i32, i64, f32, f64, char, bool,
|
||||
];
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl_to_value_nonzero_primitive![
|
||||
NonZeroUsize, NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128,
|
||||
NonZeroIsize, NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128,
|
||||
NonZeroUsize, NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64,
|
||||
NonZeroIsize, NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64,
|
||||
];
|
||||
|
||||
impl_value_to_primitive![
|
||||
@@ -617,12 +665,12 @@ pub trait Visit<'v> {
|
||||
|
||||
/// Visit a big unsigned integer.
|
||||
fn visit_u128(&mut self, value: u128) -> Result<(), Error> {
|
||||
self.visit_any(value.into())
|
||||
self.visit_any((&value).into())
|
||||
}
|
||||
|
||||
/// Visit a big signed integer.
|
||||
fn visit_i128(&mut self, value: i128) -> Result<(), Error> {
|
||||
self.visit_any(value.into())
|
||||
self.visit_any((&value).into())
|
||||
}
|
||||
|
||||
/// Visit a floating point.
|
||||
|
||||
Reference in New Issue
Block a user