(
&mut self,
dest: Resource<DynOutputStream>,
src: Resource<DynInputStream>,
len: u64,
)
| 217 | } |
| 218 | |
| 219 | async fn blocking_splice( |
| 220 | &mut self, |
| 221 | dest: Resource<DynOutputStream>, |
| 222 | src: Resource<DynInputStream>, |
| 223 | len: u64, |
| 224 | ) -> StreamResult<u64> { |
| 225 | let len = len.try_into().unwrap_or(usize::MAX); |
| 226 | |
| 227 | let permit = { |
| 228 | let output = self.get_mut(&dest)?; |
| 229 | output.write_ready().await? |
| 230 | }; |
| 231 | let len = len.min(permit); |
| 232 | if len == 0 { |
| 233 | return Ok(0); |
| 234 | } |
| 235 | |
| 236 | let contents = self.get_mut(&src)?.blocking_read(len).await?; |
| 237 | |
| 238 | let len = contents.len(); |
| 239 | if len == 0 { |
| 240 | return Ok(0); |
| 241 | } |
| 242 | |
| 243 | let output = self.get_mut(&dest)?; |
| 244 | output.blocking_write_and_flush(contents).await?; |
| 245 | Ok(len.try_into().expect("usize can fit in u64")) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | impl streams::HostInputStream for ResourceTable { |
no test coverage detected