Function faketime::faketime::millis_tempfile
source · Expand description
Writes time into a temporary file and return the file.
It returns the handle to the timestamp file on success.
use std::fs;
let faketime_file = faketime::millis_tempfile(123).expect("create faketime file");
assert_eq!(fs::read_to_string(&faketime_file).ok(), Some("123".to_string()));
The file is deleted when the handle goes out of scope.
let path = {
let faketime_file = faketime::millis_tempfile(123).expect("create faketime file");
faketime_file.to_path_buf()
};
assert!(!path.exists());