use crate::decompile::DecompiledType;
use crate::error::{Error, Result};
use std::path::Path;
pub fn write_types(out_dir: &Path, types: &[DecompiledType]) -> Result<usize> {
std::fs::create_dir_all(out_dir)
.map_err(Error::Io)?;
let mut count = 0;
for t in types {
let path = out_dir.join(&t.file_name);
std::fs::write(&path, &t.source).map_err(Error::Io)?;
count += 1;
}
Ok(count)
}