impl Send + Sync mark for archive extract API (#12)

This commit is contained in:
2026-04-13 15:35:01 +08:00
parent 034f4f7a52
commit 4f7d696dbe
21 changed files with 96 additions and 78 deletions

View File

@@ -273,7 +273,7 @@ impl<'b, T: Read + Seek + std::fmt::Debug + 'b> BgiArchive<'b, T> {
}
}
impl<'b, T: Read + Seek + std::fmt::Debug + 'b> Script for BgiArchive<'b, T> {
impl<'b, T: Read + Seek + std::fmt::Debug + Send + Sync + 'b> Script for BgiArchive<'b, T> {
fn default_output_script_type(&self) -> OutputScriptType {
OutputScriptType::Json
}
@@ -298,7 +298,7 @@ impl<'b, T: Read + Seek + std::fmt::Debug + 'b> Script for BgiArchive<'b, T> {
Ok(Box::new(self.entries.iter().map(|e| Ok(e.offset as u64))))
}
fn open_file<'a>(&'a self, index: usize) -> Result<Box<dyn ArchiveContent + 'a>> {
fn open_file<'a>(&'a self, index: usize) -> Result<Box<dyn ArchiveContent + Send + Sync + 'a>> {
if index >= self.entries.len() {
return Err(anyhow::anyhow!(
"Index out of bounds: {} (max: {})",
@@ -488,7 +488,7 @@ impl<F: Fn(&[u8], usize, &str) -> Option<&'static ScriptType>> ArchiveContent fo
Ok(self.data.data.clone())
}
fn to_data<'a>(&'a mut self) -> Result<Box<dyn ReadSeek + 'a>> {
fn to_data<'a>(&'a mut self) -> Result<Box<dyn ReadSeek + Send + Sync + 'a>> {
Ok(Box::new(&mut self.data))
}
}

View File

@@ -244,7 +244,7 @@ impl<F: Fn(&[u8], usize, &str) -> Option<&'static ScriptType>> ArchiveContent fo
Ok(self.data.data.clone())
}
fn to_data<'a>(&'a mut self) -> Result<Box<dyn ReadSeek + 'a>> {
fn to_data<'a>(&'a mut self) -> Result<Box<dyn ReadSeek + 'a + Send + Sync>> {
Ok(Box::new(&mut self.data))
}
}
@@ -305,7 +305,7 @@ impl<'b, T: Read + Seek + std::fmt::Debug + 'b> BgiArchive<'b, T> {
}
}
impl<'b, T: Read + Seek + std::fmt::Debug + 'b> Script for BgiArchive<'b, T> {
impl<'b, T: Read + Seek + std::fmt::Debug + Send + Sync + 'b> Script for BgiArchive<'b, T> {
fn default_output_script_type(&self) -> OutputScriptType {
OutputScriptType::Json
}
@@ -330,7 +330,7 @@ impl<'b, T: Read + Seek + std::fmt::Debug + 'b> Script for BgiArchive<'b, T> {
Ok(Box::new(self.entries.iter().map(|e| Ok(e.offset as u64))))
}
fn open_file<'a>(&'a self, index: usize) -> Result<Box<dyn ArchiveContent + 'a>> {
fn open_file<'a>(&'a self, index: usize) -> Result<Box<dyn ArchiveContent + Send + Sync + 'a>> {
if index >= self.entries.len() {
return Err(anyhow::anyhow!(
"Index out of bounds: {} (max: {})",