MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / new

Method new

aiscript-runtime/src/config/mod.rs:109–117  ·  view source on GitHub ↗
(source: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

107
108impl Config {
109 fn new(source: impl AsRef<Path>) -> Result<Self, Box<dyn std::error::Error>> {
110 let path = source.as_ref();
111 if path.exists() {
112 let content = fs::read_to_string(path)?;
113 Ok(toml::from_str(&content)?)
114 } else {
115 Ok(Config::default())
116 }
117 }
118
119 pub fn load(path: &str) -> &Config {
120 CONFIG.get_or_init(|| {

Callers

nothing calls this directly

Calls 1

as_refMethod · 0.45

Tested by

no test coverage detected