Skip to content

Commit de04763

Browse files
committed
Do not box data for chunk reader.
1 parent bc825cf commit de04763

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

.idea/runConfigurations/build_cli_debug.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/build_cli_release.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/test__xray_chunk.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/xray-chunk/src/iterator/chunk_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<T: ChunkDataSource> Iterator for ChunkIterator<'_, T> {
6060
id,
6161
size: size as u64,
6262
position,
63-
data: Box::new(self.reader.data.slice(position..(position + size as u64))),
63+
data: self.reader.data.slice(position..(position + size as u64)),
6464
})
6565
}
6666
}

crates/xray-chunk/src/iterator/chunk_size_packed_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<T: ChunkDataSource> Iterator for ChunkSizePackedIterator<'_, T> {
5252
id,
5353
size,
5454
position,
55-
data: Box::new(self.reader.data.slice(position + 4..position + size)),
55+
data: self.reader.data.slice(position + 4..position + size),
5656
})
5757
}
5858
}

crates/xray-chunk/src/reader/chunk_reader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct ChunkReader<T: ChunkDataSource = FileSlice> {
1313
pub id: u32,
1414
pub size: u64,
1515
pub position: u64,
16-
pub data: Box<T>,
16+
pub data: T,
1717
}
1818

1919
impl ChunkReader<FileSlice> {
@@ -34,7 +34,7 @@ impl ChunkReader<FileSlice> {
3434
id: 0,
3535
size: slice.len() as u64,
3636
position: slice.start_pos(),
37-
data: Box::new(slice),
37+
data: slice,
3838
})
3939
}
4040
}
@@ -51,7 +51,7 @@ impl ChunkReader<InMemoryChunkDataSource> {
5151
id: 0,
5252
size: source.len(),
5353
position: 0,
54-
data: Box::new(source),
54+
data: source,
5555
})
5656
}
5757
}

0 commit comments

Comments
 (0)