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}
44
45#[derive(Debug, Clone, Deserialize)]
46pub struct CommitInfo {
47    pub header: String,
48    pub parent: Option<String>,
49    pub date: String,
50    pub fulldiff: Option<String>,
51    pub phab: Option<String>,
52}
53
54#[derive(Debug, Clone)]
55pub struct BlameInfo {
56    pub commit_hash: String,
57    pub original_path: String,
58    pub original_line: usize,
59    pub commit_info: Option<CommitInfo>,
60}
61
62#[derive(Debug, Clone)]
63pub struct ParsedCommitInfo {
64    pub bug_number: Option<u64>,
65    pub message: String,
66    pub author: String,
67    pub date: String,
68}