parse_book_source/book_source/
http_config.rs

1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
5#[serde(rename_all = "camelCase")]
6pub struct HttpConfig {
7    pub timeout: Option<u64>,
8    pub header: Option<HashMap<String, String>>,
9    /// 请求速率限制(令牌桶算法)
10    pub rate_limit: Option<RateLimit>,
11}
12
13#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
14#[serde(rename_all = "camelCase")]
15pub struct RateLimit {
16    /// 每秒钟最大请求次数
17    pub max_count: u64,
18    /// 每隔多少秒补充一次令牌
19    pub fill_duration: f64,
20}