fix style to match crate
This commit is contained in:
@@ -12,7 +12,7 @@ pub const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
|||||||
// ==== helper functions to easily construct h2 Frames ====
|
// ==== helper functions to easily construct h2 Frames ====
|
||||||
|
|
||||||
pub fn headers<T>(id: T) -> MockHeaders
|
pub fn headers<T>(id: T) -> MockHeaders
|
||||||
where T: Into<StreamId>,
|
where T: Into<StreamId>,
|
||||||
{
|
{
|
||||||
MockHeaders(frame::Headers::new(
|
MockHeaders(frame::Headers::new(
|
||||||
id.into(),
|
id.into(),
|
||||||
@@ -22,14 +22,14 @@ where T: Into<StreamId>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn data<T, B>(id: T, buf: B) -> MockData
|
pub fn data<T, B>(id: T, buf: B) -> MockData
|
||||||
where T: Into<StreamId>,
|
where T: Into<StreamId>,
|
||||||
B: Into<Bytes>,
|
B: Into<Bytes>,
|
||||||
{
|
{
|
||||||
MockData(frame::Data::new(id.into(), buf.into()))
|
MockData(frame::Data::new(id.into(), buf.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn window_update<T>(id: T, sz: u32) -> frame::WindowUpdate
|
pub fn window_update<T>(id: T, sz: u32) -> frame::WindowUpdate
|
||||||
where T: Into<StreamId>,
|
where T: Into<StreamId>,
|
||||||
{
|
{
|
||||||
frame::WindowUpdate::new(id.into(), sz)
|
frame::WindowUpdate::new(id.into(), sz)
|
||||||
}
|
}
|
||||||
@@ -40,8 +40,8 @@ pub struct MockHeaders(frame::Headers);
|
|||||||
|
|
||||||
impl MockHeaders {
|
impl MockHeaders {
|
||||||
pub fn request<M, U>(self, method: M, uri: U) -> Self
|
pub fn request<M, U>(self, method: M, uri: U) -> Self
|
||||||
where M: HttpTryInto<http::Method>,
|
where M: HttpTryInto<http::Method>,
|
||||||
U: HttpTryInto<http::Uri>,
|
U: HttpTryInto<http::Uri>,
|
||||||
{
|
{
|
||||||
let method = method.try_into().unwrap();
|
let method = method.try_into().unwrap();
|
||||||
let uri = uri.try_into().unwrap();
|
let uri = uri.try_into().unwrap();
|
||||||
@@ -55,7 +55,7 @@ impl MockHeaders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn response<S>(self, status: S) -> Self
|
pub fn response<S>(self, status: S) -> Self
|
||||||
where S: HttpTryInto<http::StatusCode>,
|
where S: HttpTryInto<http::StatusCode>,
|
||||||
{
|
{
|
||||||
let status = status.try_into().unwrap();
|
let status = status.try_into().unwrap();
|
||||||
let (id, _, fields) = self.into_parts();
|
let (id, _, fields) = self.into_parts();
|
||||||
@@ -148,8 +148,8 @@ pub trait HttpTryInto<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, U> HttpTryInto<T> for U
|
impl<T, U> HttpTryInto<T> for U
|
||||||
where T: HttpTryFrom<U>,
|
where T: HttpTryFrom<U>,
|
||||||
T::Error: fmt::Debug,
|
T::Error: fmt::Debug,
|
||||||
{
|
{
|
||||||
type Error = T::Error;
|
type Error = T::Error;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user