const fn get_dockerfile() -> String {
let mut file_content = String::new();
let mut file = File::open("dockers/PostgreSql").expect("Failed to read the file");
file.read_to_string(&mut file_content);
file_content
}
const DOCKERFILE: String = get_dockerfile();
I'm writing a Rust script to manage docker operations.
- I want to include docker-file content in my binary executable.
- I thought by assigning that content into a
constvariable I could achieve this but I am getting this error:
error[E0723]: mutable references in const fn are unstable
--> src/main.rs:9:5
|
9 | file.read_to_string(&mut file_content);