From 5303e71647c80f409d8a4c81e76026dd52f018ec Mon Sep 17 00:00:00 2001 From: Jia Chao Date: Mon, 3 Jun 2024 10:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=8F=E5=88=97=E5=8C=96?= =?UTF-8?q?=E3=80=81=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jia Chao --- Cargo.toml | 1 + src/lib.rs | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 75578fc..75a79f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,4 @@ description = "An xml parser for openEuler cvrf." # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +serde = { version = "1", features = ["serde_derive"] } diff --git a/src/lib.rs b/src/lib.rs index 61f1f01..2efc8e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,8 +2,9 @@ debug_assertions, allow(dead_code, unused_imports, unused_variables, unused_mut) )] +use serde::{Serialize, Deserialize}; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct CVRF { // pub documenttitle: String, @@ -46,7 +47,7 @@ impl CVRF { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct Publisher; impl Publisher { @@ -55,7 +56,7 @@ impl Publisher { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct DocumentTracking; impl DocumentTracking { @@ -64,7 +65,7 @@ impl DocumentTracking { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct Note; impl Note { @@ -73,7 +74,7 @@ impl Note { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct Reference; impl Reference { @@ -82,7 +83,7 @@ impl Reference { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct ProductTree; impl ProductTree { @@ -91,7 +92,7 @@ impl ProductTree { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] struct Vulnerability; impl Vulnerability {