Performs a HTTP requests and calls the given callback once for the initial response, and then once for each chunk in the response body. You can abort the fetch by returning [`ControlFlow::Break`] from the callback.
(
request: Request,
on_data: impl 'static + Send + Fn(crate::Result<types::Part>) -> ControlFlow<()>,
)
| 53 | /// |
| 54 | /// You can abort the fetch by returning [`ControlFlow::Break`] from the callback. |
| 55 | pub fn fetch( |
| 56 | request: Request, |
| 57 | on_data: impl 'static + Send + Fn(crate::Result<types::Part>) -> ControlFlow<()>, |
| 58 | ) { |
| 59 | #[cfg(not(target_arch = "wasm32"))] |
| 60 | native::fetch_streaming(request, Box::new(on_data)); |
| 61 | |
| 62 | #[cfg(target_arch = "wasm32")] |
| 63 | web::fetch_streaming(request, Box::new(on_data)); |
| 64 | } |
| 65 | |
| 66 | #[cfg(not(target_arch = "wasm32"))] |
| 67 | mod native; |
nothing calls this directly
no test coverage detected