verilization_compiler/
file_output_handler.rs1use std::fs;
2use std::fs::File;
3use std::path::Path;
4use crate::lang::{OutputHandler, GeneratorError};
5
6pub struct FileOutputHandler {}
8
9impl <'output> OutputHandler<'output> for FileOutputHandler {
10 type FileHandle = File;
11 fn create_file<P: AsRef<Path>>(&'output mut self, path: P) -> Result<Self::FileHandle, GeneratorError> {
12 if let Some(dir) = path.as_ref().parent() {
13 fs::create_dir_all(dir)?;
14 }
15
16 Ok(File::create(path)?)
17 }
18}