Skip to content

Commit 4ca0136

Browse files
committed
Prefer From trait over Into to fix small performance regression
1 parent 3363b07 commit 4ca0136

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎engine/src/types.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ mod private {
490490
impl SealedIntoValue for Ipv4Addr {}
491491
impl SealedIntoValue for Ipv6Addr {}
492492

493-
impl<'a, T: Into<Bytes<'a>>> SealedIntoValue for T {}
493+
impl<'a, T> SealedIntoValue for T where Bytes<'a>: From<T> {}
494494

495495
impl<'a, V: IntoValue<'a>> SealedIntoValue for TypedArray<'a, V> {}
496496
impl<'a, V: IntoValue<'a>> SealedIntoValue for TypedMap<'a, V> {}
@@ -596,12 +596,15 @@ impl<'a> IntoValue<'a> for Ipv6Addr {
596596
}
597597
}
598598

599-
impl<'a, T: Into<Bytes<'a>>> IntoValue<'a> for T {
599+
impl<'a, T> IntoValue<'a> for T
600+
where
601+
Bytes<'a>: From<T>,
602+
{
600603
const TYPE: Type = Type::Bytes;
601604

602605
#[inline]
603606
fn into_value(self) -> LhsValue<'a> {
604-
LhsValue::Bytes(self.into())
607+
LhsValue::Bytes(Bytes::from(self))
605608
}
606609
}
607610

0 commit comments

Comments
 (0)