Skip to main content

devscout_rs/graph/
def.rs

1use serde::{Deserialize, Serialize};
2
3use super::fragment_types::is_zero;
4
5// ---------------------------------------------------------------------------
6// graph.json schema.
7// ---------------------------------------------------------------------------
8
9#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10/// Represents `AlsoIn`.
11pub struct AlsoIn {
12    /// The file value.
13    pub file: String,
14    /// The line value.
15    pub line: usize,
16}
17
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
19/// Represents `Def`.
20pub struct Def {
21    /// The id value.
22    pub id: String,
23    /// The name value.
24    pub name: String,
25    /// The namespace value.
26    pub namespace: String,
27    /// The kind value.
28    pub kind: String,
29    /// The file value.
30    pub file: String,
31    /// The line value.
32    pub line: usize,
33    /// The methods value.
34    pub methods: Vec<String>,
35    /// Test-coverage stage -- the one member fact that SURVIVES onto disk
36    /// (`properties`/`fields`/`extensionMethods`/`bases` are resolution inputs
37    /// only, stripped before the row is written): `devscout tests` reads it back
38    /// out of graph.json. Positioned after `methods` and before `also_in`, and
39    /// omitted when empty, so a def declaring no tests keeps its exact
40    /// pre-stage bytes.
41    #[serde(default, rename = "testMethods", skip_serializing_if = "Vec::is_empty")]
42    pub test_methods: Vec<String>,
43    #[serde(default, skip_serializing_if = "Vec::is_empty")]
44    /// The also in value.
45    pub also_in: Vec<AlsoIn>,
46    #[serde(default, rename = "endLine", skip_serializing_if = "is_zero")]
47    /// The end line value.
48    pub end_line: usize,
49}