refactor(uri): make ByteStr an implementation detail of uri

This commit is contained in:
Yazad Daruvala
2017-06-23 21:52:56 -07:00
parent 579d360f51
commit 3021cd9dd8
6 changed files with 11 additions and 22 deletions

View File

@@ -2,8 +2,8 @@ use std::error::Error as StdError;
use std::fmt::{Display, self};
use std::str::{self, FromStr};
use http::ByteStr;
use bytes::{BufMut, BytesMut};
use ::common::ByteStr;
use bytes::{BufMut, Bytes, BytesMut};
/// The Request-URI of a Request's StartLine.
///
@@ -297,8 +297,8 @@ impl Display for Uri {
}
}
pub fn from_byte_str(s: ByteStr) -> Result<Uri, UriError> {
Uri::new(s)
pub unsafe fn from_utf8_unchecked(slice: Bytes) -> Result<Uri, UriError> {
Uri::new(ByteStr::from_utf8_unchecked(slice))
}
pub fn scheme_and_authority(uri: &Uri) -> Option<Uri> {