net/fetch/
fetch_params.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use net_traits::request::Request;
6use net_traits::response::Response;
7
8/// <https://fetch.spec.whatwg.org/#fetch-params-preloaded-response-candidate>
9#[derive(Clone)]
10pub(crate) enum PreloadResponseCandidate {
11    None,
12    Pending,
13    Response(Box<Response>),
14}
15
16/// <https://fetch.spec.whatwg.org/#fetch-params>
17#[derive(Clone)]
18pub struct FetchParams {
19    /// <https://fetch.spec.whatwg.org/#fetch-params-request>
20    pub request: Request,
21    /// <https://fetch.spec.whatwg.org/#fetch-params-preloaded-response-candidate>
22    pub(crate) preload_response_candidate: PreloadResponseCandidate,
23}
24
25impl FetchParams {
26    pub fn new(request: Request) -> FetchParams {
27        FetchParams {
28            request,
29            preload_response_candidate: PreloadResponseCandidate::None,
30        }
31    }
32}