MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / deserialize_json_file

Function deserialize_json_file

dstack-util/src/utils.rs:13–16  ·  view source on GitHub ↗
(path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

11pub use dstack_types::{AppCompose, AppKeys, KeyProviderKind, SysConfig};
12
13pub fn deserialize_json_file<T: DeserializeOwned>(path: impl AsRef<Path>) -> Result<T> {
14 let data = fs::read_to_string(path).context("Failed to read file")?;
15 serde_json::from_str(&data).context("Failed to parse json")
16}
17
18pub fn sha256(data: &[u8]) -> [u8; 32] {
19 use sha2::Digest;

Callers 3

loadMethod · 0.85
cmd_gateway_refreshFunction · 0.85
load_or_defaultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected