From fab9f3c35cb39d78aedb59da96c44d4765441278 Mon Sep 17 00:00:00 2001 From: psp_dada <1824427006@qq.com> Date: Tue, 24 Dec 2024 20:53:59 +0800 Subject: [PATCH] Fix: Use unwrap_or for optional fields in list_all_course function --- examples/req_auth.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/req_auth.rs b/examples/req_auth.rs index 93e9e6d..cc7ca6c 100644 --- a/examples/req_auth.rs +++ b/examples/req_auth.rs @@ -204,7 +204,7 @@ fn list_all_course(all_course: &Vec) { "Course id: {}, Course name: {}, Course teacher: {} {}", course["id"].as_str().unwrap().green().bold(), course["kcmc"].as_str().unwrap().purple().bold(), - course["dgjsmc"].as_str().unwrap().blue().bold(), + course["dgjsmc"].as_str().unwrap_or("").blue().bold(), course["tyxmmc"].as_str().unwrap_or("") ) }