Added function to set value for metadata for known types (#29)
All checks were successful
Release Tagging / release (push) Successful in 28s
Rust Build / Check (push) Successful in 28s
Rust Build / Check (pull_request) Successful in 25s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (push) Successful in 23s
Rust Build / Clippy (push) Successful in 27s
Rust Build / build (push) Successful in 32s
Rust Build / Test Suite (pull_request) Successful in 28s
Rust Build / Rustfmt (pull_request) Successful in 23s
Rust Build / Clippy (pull_request) Successful in 27s
Rust Build / build (pull_request) Successful in 31s
All checks were successful
Release Tagging / release (push) Successful in 28s
Rust Build / Check (push) Successful in 28s
Rust Build / Check (pull_request) Successful in 25s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (push) Successful in 23s
Rust Build / Clippy (push) Successful in 27s
Rust Build / build (push) Successful in 32s
Rust Build / Test Suite (pull_request) Successful in 28s
Rust Build / Rustfmt (pull_request) Successful in 23s
Rust Build / Clippy (pull_request) Successful in 27s
Rust Build / build (pull_request) Successful in 31s
Reviewed-on: #29 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
17
src/meta.rs
17
src/meta.rs
@@ -244,6 +244,23 @@ pub mod metadata {
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_value(value: types::MetadataType) -> String {
|
||||
match value {
|
||||
types::MetadataType::String(val) => val,
|
||||
types::MetadataType::Int(val) => val.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_meta_value(
|
||||
t: types::Type,
|
||||
filepath: &String,
|
||||
value: types::MetadataType,
|
||||
) -> Result<String, std::io::Error> {
|
||||
let parsed_val = parse_value(value);
|
||||
|
||||
set_meta(t, filepath, &parsed_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user