#[non_exhaustive]pub struct FetchCmd {
pub cancel: Option<CancellationToken>,
pub headers: Option<Headers>,
pub on_complete: Option<OnCompleteFn>,
pub on_response: Option<OnResponseFn>,
pub range: Option<RangeSpec>,
pub validator: Option<fn(&Headers) -> NetResult<()>>,
pub writer: Option<WriterFn>,
pub method: RequestMethod,
pub url: Url,
}Expand description
A single download command.
Built by protocol code via FetchCmd::get / FetchCmd::head
constructors and executed via
PeerHandle::execute. The downloader
establishes the HTTP connection and returns a
FetchResponse with headers and a body stream.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cancel: Option<CancellationToken>Epoch cancel token from the Peer. When set, the Downloader
combines it with the track-level cancel via [CancelGroup].
headers: Option<Headers>Additional HTTP headers for this request.
on_complete: Option<OnCompleteFn>Streaming path completion handler. None for channel path (execute/batch).
on_response: Option<OnResponseFn>Streaming path response callback — fires once when the
response is ready, before the body streams. None for the
channel path (execute/batch).
range: Option<RangeSpec>Optional byte range (HTTP Range request).
validator: Option<fn(&Headers) -> NetResult<()>>Optional per-request response validator.
Called with the response headers after a successful HTTP response.
Return Err to reject the response before the body is consumed.
writer: Option<WriterFn>Streaming path body writer. None for channel path (execute/batch).
method: RequestMethodHTTP method.
url: UrlURL to fetch.