gitbundle_sdk/models/
commit_file_stats.rs1use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CommitFileStats {
17 #[serde(rename = "change_type")]
18 pub change_type: models::FileDiffStatus,
19 #[serde(rename = "deletions")]
20 pub deletions: i32,
21 #[serde(rename = "insertions")]
22 pub insertions: i32,
23 #[serde(
24 rename = "old_path",
25 default,
26 with = "::serde_with::rust::double_option",
27 skip_serializing_if = "Option::is_none"
28 )]
29 pub old_path: Option<Option<String>>,
30 #[serde(rename = "path")]
31 pub path: String,
32}
33
34impl CommitFileStats {
35 pub fn new(
36 change_type: models::FileDiffStatus,
37 deletions: i32,
38 insertions: i32,
39 path: String,
40 ) -> CommitFileStats {
41 CommitFileStats {
42 change_type,
43 deletions,
44 insertions,
45 old_path: None,
46 path,
47 }
48 }
49}