Struct worker::ObjectBody
source · pub struct ObjectBody<'body> { /* private fields */ }
Expand description
The data contained within an Object.
Implementations§
source§impl<'body> ObjectBody<'body>
impl<'body> ObjectBody<'body>
sourcepub fn stream(self) -> Result<ByteStream>
pub fn stream(self) -> Result<ByteStream>
Reads the data in the Object via a ByteStream.
sourcepub fn response_body(self) -> Result<ResponseBody>
pub fn response_body(self) -> Result<ResponseBody>
Returns a ResponseBody containing the data in the Object.
This function can be used to hand off the Object data to the workers runtime for streaming to the client in a crate::Response. This ensures that the worker does not consume CPU time while the streaming occurs, which can be significant if instead ObjectBody::stream is used.
pub async fn bytes(self) -> Result<Vec<u8>>
pub async fn text(self) -> Result<String>
Auto Trait Implementations§
impl<'body> Freeze for ObjectBody<'body>
impl<'body> RefUnwindSafe for ObjectBody<'body>
impl<'body> !Send for ObjectBody<'body>
impl<'body> !Sync for ObjectBody<'body>
impl<'body> Unpin for ObjectBody<'body>
impl<'body> UnwindSafe for ObjectBody<'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