@@ -4,34 +4,58 @@ use std::path::PathBuf;
4
4
5
5
use rust_code_analysis:: { metrics, Callback , FuncSpace , ParserTrait } ;
6
6
7
+ /// Payload containing source code used to compute metrics.
7
8
#[ derive( Debug , Deserialize , Serialize ) ]
8
9
pub struct WebMetricsPayload {
10
+ /// Payload identifier.
9
11
pub id : String ,
12
+ /// Source code filename.
10
13
pub file_name : String ,
14
+ /// Source code used to compute metrics.
11
15
pub code : String ,
16
+ /// Flag to consider only unit space metrics.
12
17
pub unit : bool ,
13
18
}
14
19
20
+ /// Server response containing metrics for every space present in
21
+ /// the requested source code.
15
22
#[ derive( Debug , Serialize ) ]
16
23
pub struct WebMetricsResponse {
24
+ /// Server response identifier.
17
25
pub id : String ,
26
+ /// Source code programming language.
18
27
pub language : String ,
28
+ /// Metrics for every space contained in the requested source code.
29
+ ///
30
+ /// If `None`, an error occurred processing the request.
19
31
pub spaces : Option < FuncSpace > ,
20
32
}
21
33
34
+ /// Source code information.
22
35
#[ derive( Debug , Deserialize ) ]
23
36
pub struct WebMetricsInfo {
37
+ /// Source code filename.
24
38
pub file_name : String ,
39
+ /// Unit space code.
40
+ ///
41
+ ///
42
+ /// If `None`, the entire code is considered.
25
43
pub unit : Option < String > ,
26
44
}
27
45
46
+ /// Server request configuration.
28
47
pub struct WebMetricsCfg {
48
+ /// Request identifier.
29
49
pub id : String ,
50
+ /// Path to the source file.
30
51
pub path : PathBuf ,
52
+ /// Flag to consider only unit space metrics.
31
53
pub unit : bool ,
54
+ /// Source code programming language.
32
55
pub language : String ,
33
56
}
34
57
58
+ /// Unit structure to implement the `Callback` trait.
35
59
pub struct WebMetricsCallback ;
36
60
37
61
impl Callback for WebMetricsCallback {
0 commit comments