MCPcopy Create free account
hub / github.com/Recordscript/recordscript / load_path

Function load_path

libs/hbb_common/src/config.rs:470–486  ·  view source on GitHub ↗
(
    file: PathBuf,
)

Source from the content-addressed store, hash-verified

468}
469
470pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug>(
471 file: PathBuf,
472) -> T {
473 let cfg = match confy::load_path(&file) {
474 Ok(config) => config,
475 Err(err) => {
476 if let confy::ConfyError::GeneralLoadError(err) = &err {
477 if err.kind() == std::io::ErrorKind::NotFound {
478 return T::default();
479 }
480 }
481 log::error!("Failed to load config '{}': {}", file.display(), err);
482 T::default()
483 }
484 };
485 cfg
486}
487
488#[inline]
489pub fn store_path<T: serde::Serialize>(path: PathBuf, cfg: T) -> crate::ResultType<()> {

Callers 2

load_Method · 0.85
loadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected