searchfox_lib/
types.rs

1use serde::Deserialize;
2use std::collections::HashMap;
3
4#[derive(Debug, Deserialize)]
5pub struct Line {
6    pub lno: usize,
7    pub line: String,
8    #[allow(dead_code)]
9    pub bounds: Option<Vec<usize>>,
10    #[allow(dead_code)]
11    pub context: Option<String>,
12    #[allow(dead_code)]
13    pub contextsym: Option<String>,
14    #[serde(rename = "peekRange")]
15    #[allow(dead_code)]
16    pub peek_range: Option<String>,
17    pub upsearch: Option<String>,
18}
19
20#[derive(Debug, Deserialize)]
21pub struct File {
22    pub path: String,
23    pub lines: Vec<Line>,
24}
25
26pub type SearchfoxResponse = HashMap<String, serde_json::Value>;
27
28#[derive(Debug)]
29pub struct RequestLog {
30    pub url: String,
31    pub method: String,
32    pub start_time: std::time::Instant,
33    pub request_id: usize,
34}
35
36#[derive(Debug)]
37#[allow(dead_code)]
38pub struct ResponseLog {
39    pub request_id: usize,
40    pub status: u16,
41    pub size_bytes: usize,
42    pub duration: std::time::Duration,
43}