MCPcopy Create free account
hub / github.com/faern/rustscript / read_file

Function read_file

src/scriptbuilder.rs:152–158  ·  view source on GitHub ↗
(path: P)

Source from the content-addressed store, hash-verified

150}
151
152fn read_file<P: AsRef<Path>>(path: P) -> Result<String> {
153 let path = path.as_ref();
154 let mut f = fs::File::open(path).chain_err(|| "Unable to read file")?;
155 let mut content = String::new();
156 f.read_to_string(&mut content).chain_err(|| "Unable to read file")?;
157 Ok(content)
158}
159
160fn compile<P: AsRef<Path>>(project_dir: P, verbose: bool) -> Result<()> {
161 let mut command = Command::new("cargo");

Callers 1

build_script_crateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected