mirror of
https://github.com/fafhrd91/actix-net
synced 2025-08-29 06:09:19 +02:00
Compare commits
2 Commits
local-wake
...
bytestring
Author | SHA1 | Date | |
---|---|---|---|
|
71b4e55c92 | ||
|
eb5fa30ada |
@@ -1,8 +1,15 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2022-xx-xx
|
## Unreleased - 2022-xx-xx
|
||||||
|
|
||||||
|
|
||||||
|
## 1.1.0 - 2022-06-11
|
||||||
|
- Implement `From<Box<str>>` for `ByteString`. [#458]
|
||||||
|
- Implement `Into<String>` for `ByteString`. [#458]
|
||||||
- Minimum supported Rust version (MSRV) is now 1.49.
|
- Minimum supported Rust version (MSRV) is now 1.49.
|
||||||
|
|
||||||
|
[#458]: https://github.com/actix/actix-net/pull/458
|
||||||
|
|
||||||
|
|
||||||
## 1.0.0 - 2020-12-31
|
## 1.0.0 - 2020-12-31
|
||||||
- Update `bytes` dependency to `1`.
|
- Update `bytes` dependency to `1`.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bytestring"
|
name = "bytestring"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
|
@@ -6,7 +6,11 @@
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
use alloc::{string::String, vec::Vec};
|
use alloc::{
|
||||||
|
boxed::Box,
|
||||||
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
use core::{borrow, convert::TryFrom, fmt, hash, ops, str};
|
use core::{borrow, convert::TryFrom, fmt, hash, ops, str};
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
@@ -110,6 +114,20 @@ impl From<&str> for ByteString {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Box<str>> for ByteString {
|
||||||
|
#[inline]
|
||||||
|
fn from(value: Box<str>) -> Self {
|
||||||
|
Self(Bytes::from(value.into_boxed_bytes()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<ByteString> for String {
|
||||||
|
#[inline]
|
||||||
|
fn from(value: ByteString) -> Self {
|
||||||
|
value.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TryFrom<&[u8]> for ByteString {
|
impl TryFrom<&[u8]> for ByteString {
|
||||||
type Error = str::Utf8Error;
|
type Error = str::Utf8Error;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user