MCPcopy Create free account
hub / github.com/douglance/devsql / read_json

Function read_json

crates/ccql/src/streaming/mod.rs:40–52  ·  view source on GitHub ↗
(path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

38}
39
40pub async fn read_json<T>(path: impl AsRef<Path>) -> Result<T>
41where
42 T: DeserializeOwned,
43{
44 let path = path.as_ref();
45 if !path.exists() {
46 return Err(Error::FileNotFound(path.display().to_string()));
47 }
48
49 let content = tokio::fs::read_to_string(path).await?;
50 let data: T = serde_json::from_str(&content)?;
51 Ok(data)
52}

Callers 2

loadMethod · 0.85
load_rawMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected