mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-29 08:09:18 +02:00
simplify MessageBody::complete_body interface (#2522)
This commit is contained in:
committed by
GitHub
parent
2cf27863cb
commit
57ea322ce5
@@ -74,18 +74,14 @@ where
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_complete_body(&self) -> bool {
|
||||
fn try_into_bytes(self) -> Result<Bytes, Self> {
|
||||
match self {
|
||||
EitherBody::Left { body } => body.is_complete_body(),
|
||||
EitherBody::Right { body } => body.is_complete_body(),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn take_complete_body(&mut self) -> Bytes {
|
||||
match self {
|
||||
EitherBody::Left { body } => body.take_complete_body(),
|
||||
EitherBody::Right { body } => body.take_complete_body(),
|
||||
EitherBody::Left { body } => body
|
||||
.try_into_bytes()
|
||||
.map_err(|body| EitherBody::Left { body }),
|
||||
EitherBody::Right { body } => body
|
||||
.try_into_bytes()
|
||||
.map_err(|body| EitherBody::Right { body }),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user