1 // Copyright (c) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 //     http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 //! Client configure module.
15 
16 use crate::util::{Redirect, Retry, Timeout};
17 
18 /// Options and flags which can be used to configure a client.
19 pub(crate) struct ClientConfig {
20     pub(crate) redirect: Redirect,
21     pub(crate) retry: Retry,
22     pub(crate) connect_timeout: Timeout,
23     pub(crate) request_timeout: Timeout,
24 }
25 
26 impl ClientConfig {
27     /// Creates a new and default `ClientConfig`.
new() -> Self28     pub(crate) fn new() -> Self {
29         Self {
30             redirect: Redirect::no_limit(),
31             retry: Retry::none(),
32             connect_timeout: Timeout::none(),
33             request_timeout: Timeout::none(),
34         }
35     }
36 }
37 
38 impl Default for ClientConfig {
default() -> Self39     fn default() -> Self {
40         Self::new()
41     }
42 }
43