Add Send + Sync mark to Box<dyn Script> (#12)

This commit is contained in:
2026-04-13 14:49:55 +08:00
parent dd2921f2dd
commit 034f4f7a52
74 changed files with 317 additions and 289 deletions

View File

@@ -2458,7 +2458,7 @@ impl<T: Seek> Seek for PrefixStream<T> {
/// A readable stream that concatenates multiple streams.
#[derive(Debug)]
pub struct MultipleReadStream<'a> {
streams: Vec<Box<dyn ReadSeek + 'a>>,
streams: Vec<Box<dyn ReadSeek + Send + Sync + 'a>>,
stream_lengths: Vec<u64>,
total_length: u64,
pos: u64,
@@ -2476,7 +2476,7 @@ impl<'a> MultipleReadStream<'a> {
}
/// Adds a new stream to the end of the concatenated streams.
pub fn add_stream<T: ReadSeek + 'a>(&mut self, mut stream: T) -> Result<()> {
pub fn add_stream<T: ReadSeek + Send + Sync + 'a>(&mut self, mut stream: T) -> Result<()> {
let length = stream.stream_length()?;
self.streams.push(Box::new(stream));
self.stream_lengths.push(self.total_length);
@@ -2485,7 +2485,7 @@ impl<'a> MultipleReadStream<'a> {
}
/// Adds a new boxed stream to the end of the concatenated streams.
pub fn add_stream_boxed(&mut self, mut stream: Box<dyn ReadSeek>) -> Result<()> {
pub fn add_stream_boxed(&mut self, mut stream: Box<dyn ReadSeek + Send + Sync>) -> Result<()> {
let length = stream.stream_length()?;
self.streams.push(stream);
self.stream_lengths.push(self.total_length);