Skip to content

Commit cbfeffb

Browse files
committed
Problem增加return type字段
1 parent 3373054 commit cbfeffb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/problem.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub fn get_problem(frontend_question_id: u32) -> Option<Problem> {
4343
sample_test_case: resp.data.question.sample_test_case,
4444
difficulty: problem.difficulty.to_string(),
4545
question_id: problem.stat.frontend_question_id,
46+
return_type: serde_json::from_str(&resp.data.question.meta_data.return_info.type_name).unwrap(),
4647
});
4748
}
4849
}
@@ -64,6 +65,7 @@ pub struct Problem {
6465
pub sample_test_case: String,
6566
pub difficulty: String,
6667
pub question_id: u32,
68+
pub return_type: String,
6769
}
6870

6971
#[derive(Serialize, Deserialize)]
@@ -111,7 +113,21 @@ struct Question {
111113
#[serde(rename = "sampleTestCase")]
112114
sample_test_case: String,
113115
#[serde(rename = "metaData")]
114-
meta_data: String,
116+
meta_data: MetaData,
117+
}
118+
119+
#[derive(Debug, Serialize, Deserialize)]
120+
struct MetaData {
121+
name:String,
122+
params: String,
123+
return_info: ReturnInfo,
124+
}
125+
126+
#[derive(Debug, Serialize, Deserialize)]
127+
struct ReturnInfo {
128+
#[serde(rename = "type")]
129+
type_name: String,
130+
params: String,
115131
}
116132

117133
#[derive(Debug, Serialize, Deserialize)]

0 commit comments

Comments
 (0)