mirror of https://github.com/fafhrd91/actix-net
perf(bytestring): improve `From<ByteString> for String` performance (#852)
This commit is contained in:
parent
cf12822c8d
commit
704bee0d84
|
|
@ -3,6 +3,7 @@
|
|||
## Unreleased
|
||||
|
||||
- Minimum supported Rust version (MSRV) is now 1.88.
|
||||
- Improve `From<ByteString> for String` performance.
|
||||
|
||||
## 1.5.0
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::{
|
||||
boxed::Box,
|
||||
string::{String, ToString},
|
||||
vec::Vec,
|
||||
};
|
||||
use alloc::{boxed::Box, string::String, vec::Vec};
|
||||
use core::{borrow::Borrow, fmt, hash, ops, str};
|
||||
|
||||
use bytes::Bytes;
|
||||
|
|
@ -189,7 +185,7 @@ impl From<Box<str>> for ByteString {
|
|||
impl From<ByteString> for String {
|
||||
#[inline]
|
||||
fn from(value: ByteString) -> Self {
|
||||
value.to_string()
|
||||
String::from_utf8(value.0.into()).expect("ByteString invariant violated")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue