Add import support for escude list

This commit is contained in:
2025-06-03 19:08:00 +08:00
parent cfd78f0c37
commit 833be4fce0
4 changed files with 76 additions and 7 deletions

View File

@@ -1,11 +1,15 @@
use crate::types::*;
use anyhow::Result;
use std::io::{Read, Seek};
use std::io::{Read, Seek, Write};
pub trait ReadSeek: Read + Seek + std::fmt::Debug {}
pub trait WriteSeek: Write + Seek {}
impl<T: Read + Seek + std::fmt::Debug> ReadSeek for T {}
impl<T: Write + Seek> WriteSeek for T {}
pub trait ScriptBuilder: std::fmt::Debug {
fn default_encoding(&self) -> Encoding;
@@ -114,6 +118,29 @@ pub trait Script: std::fmt::Debug {
))
}
fn custom_import(
&self,
_custom_filename: &str,
_file: Box<dyn WriteSeek>,
_encoding: Encoding,
_output_encoding: Encoding,
) -> Result<()> {
Err(anyhow::anyhow!(
"This script type does not support custom import."
))
}
fn custom_import_filename(
&self,
custom_filename: &str,
filename: &str,
encoding: Encoding,
output_encoding: Encoding,
) -> Result<()> {
let f = std::fs::File::create(filename)?;
self.custom_import(custom_filename, Box::new(f), encoding, output_encoding)
}
fn is_archive(&self) -> bool {
false
}