Skip to main content

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    pub context_before: Option<Vec<String>>,
19    pub context_after: Option<Vec<String>>,
20}
21
22#[derive(Debug, Deserialize)]
23pub struct File {
24    pub path: String,
25    pub lines: Vec<Line>,
26}
27
28pub type SearchfoxResponse = HashMap<String, serde_json::Value>;
29
30#[derive(Debug)]
31pub struct RequestLog {
32    pub url: String,
33    pub method: String,
34    pub start_time: std::time::Instant,
35    pub request_id: usize,
36}
37
38#[derive(Debug)]
39#[allow(dead_code)]
40pub struct ResponseLog {
41    pub request_id: usize,
42    pub status: u16,
43    pub size_bytes: usize,
44    pub duration: std::time::Duration,
45}
46
47#[derive(Debug, Clone, Deserialize)]
48pub struct CommitInfo {
49    pub header: String,
50    pub parent: Option<String>,
51    pub date: String,
52    pub fulldiff: Option<String>,
53    pub phab: Option<String>,
54}
55
56#[derive(Debug, Clone)]
57pub struct BlameInfo {
58    pub commit_hash: String,
59    pub original_path: String,
60    pub original_line: usize,
61    pub commit_info: Option<CommitInfo>,
62}
63
64#[derive(Debug, Clone)]
65pub struct ParsedCommitInfo {
66    pub bug_number: Option<u64>,
67    pub message: String,
68    pub author: String,
69    pub date: String,
70}