pub struct Body {
pub status: Status,
pub headers: Headers,
/* private fields */
}Expand description
A response whose body is read as it arrives.
Fields§
§status: Status§headers: HeadersImplementations§
Source§impl Body
impl Body
Sourcepub fn from_bytes(status: Status, headers: Headers, body: Vec<u8>) -> Body
pub fn from_bytes(status: Status, headers: Headers, body: Vec<u8>) -> Body
A body that is already in memory, for fakes and tests.
Sourcepub async fn chunk(&mut self) -> Result<Option<Vec<u8>>>
pub async fn chunk(&mut self) -> Result<Option<Vec<u8>>>
The next piece of the body, or None when it is complete.
pub async fn text(self) -> Result<String>
Auto Trait Implementations§
impl !RefUnwindSafe for Body
impl !UnwindSafe for Body
impl Freeze for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnsafeUnpin for Body
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more