mirror of
https://github.com/openharmony/third_party_rust_http.git
synced 2026-07-19 22:53:59 -04:00
Rename Builder::head
This commit is contained in:
+1
-5
@@ -32,11 +32,7 @@ enum ErrorKind {
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", error::Error::description(self))?;
|
||||
match self.inner {
|
||||
ErrorKind::Io(ref e) => write!(f, ": {}", e),
|
||||
_ => Ok(())
|
||||
}
|
||||
error::Error::description(self).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -508,8 +508,7 @@ impl Builder {
|
||||
self
|
||||
}
|
||||
|
||||
/// "Consumes" this builder, returning the constructed `Head`.
|
||||
fn head(&mut self) -> Result<Parts> {
|
||||
fn take_parts(&mut self) -> Result<Parts> {
|
||||
let ret = self.head.take().expect("cannot reuse request builder");
|
||||
if let Some(e) = self.err.take() {
|
||||
return Err(e)
|
||||
@@ -544,7 +543,7 @@ impl Builder {
|
||||
/// ```
|
||||
pub fn body<T>(&mut self, body: T) -> Result<Request<T>> {
|
||||
Ok(Request {
|
||||
head: self.head()?,
|
||||
head: self.take_parts()?,
|
||||
body: body,
|
||||
})
|
||||
}
|
||||
|
||||
+2
-3
@@ -450,8 +450,7 @@ impl Builder {
|
||||
self
|
||||
}
|
||||
|
||||
/// "Consumes" this builder, returning the constructed `Parts`.
|
||||
fn head(&mut self) -> Result<Parts> {
|
||||
fn take_parts(&mut self) -> Result<Parts> {
|
||||
let ret = self.head.take().expect("cannot reuse response builder");
|
||||
if let Some(e) = self.err.take() {
|
||||
return Err(e)
|
||||
@@ -486,7 +485,7 @@ impl Builder {
|
||||
/// ```
|
||||
pub fn body<T>(&mut self, body: T) -> Result<Response<T>> {
|
||||
Ok(Response {
|
||||
head: self.head()?,
|
||||
head: self.take_parts()?,
|
||||
body: body,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user