Skip to content

Commit

Permalink
Use default on functions field.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Oct 25, 2023
1 parent faee893 commit 6b9bca2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ mod doc_gen {

#[derive(Serialize, Deserialize, Debug, Clone)]
struct Metadata {
pub functions: Option<Vec<DocFunc>>,
#[serde(default)]
pub functions: Vec<DocFunc>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down Expand Up @@ -133,7 +134,7 @@ mod doc_gen {
// Extract metadata
let json_fns = engine.gen_fn_metadata_to_json(false).unwrap();
let v: Metadata = serde_json::from_str(&json_fns).unwrap();
let function_list = v.functions.as_ref().map_or(&[][..], Vec::as_slice);
let function_list = v.functions;

// Write functions
let mut indented = false;
Expand Down

0 comments on commit 6b9bca2

Please sign in to comment.