MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / bytes_contents

Method bytes_contents

src/http/body.rs:179–185  ·  view source on GitHub ↗

Collect the entire contents of this `Body`, and expose it as `Bytes`. This async fn will be pending until the entire `Body` is copied into memory, or an error occurs.

(&mut self)

Source from the content-addressed store, hash-verified

177 /// This async fn will be pending until the entire `Body` is
178 /// copied into memory, or an error occurs.
179 pub async fn bytes_contents(&mut self) -> Result<Bytes, Error> {
180 let _ = self.contents().await?;
181 match &self.0 {
182 BodyInner::Complete { data, .. } => Ok(data.clone()),
183 _ => unreachable!(),
184 }
185 }
186
187 /// Get a value for the length of this `Body`'s content, in bytes, if
188 /// known. This value can come from either the Content-Length header

Callers

nothing calls this directly

Calls 1

contentsMethod · 0.80

Tested by

no test coverage detected