use std::fs::File; use std::io::Write; use std::path::Path; extern crate time; fn main() { let dest_path = Path::new("src/version.rs"); let mut f = File::create(&dest_path).unwrap(); let code = format!( r#" pub fn get_version() -> &'static str {{ {:?} }} "#, time::now().rfc3339().to_string() ); f.write(code.trim().as_bytes()).unwrap(); }