MCPcopy Create free account
hub / github.com/emilk/ehttp / fetch

Function fetch

ehttp/src/streaming/mod.rs:55–64  ·  view source on GitHub ↗

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<()>,
)

Source from the content-addressed store, hash-verified

53///
54/// You can abort the fetch by returning [`ControlFlow::Break`] from the callback.
55pub 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"))]
67mod native;

Callers

nothing calls this directly

Calls 1

fetch_streamingFunction · 0.70

Tested by

no test coverage detected