Skip to content

Commit

Permalink
use &[T].to_vec() when converting ndarray to Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
nmandery committed Oct 10, 2024
1 parent e41fc9d commit d1fa058
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/raster/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ impl<T: GdalType + Copy> From<Array2<T>> for Buffer<T> {
let (cols, rows) = (shape[1], shape[0]);
let data: Vec<T> = if value.is_standard_layout() {
let (data, offset) = value.into_raw_vec_and_offset();
if let Some(offset) = offset {
data.into_iter().skip(offset).collect()
} else {
data
}
data.as_slice()[offset.unwrap_or_default()..].to_vec()
} else {
value.iter().copied().collect()
};
Expand Down

0 comments on commit d1fa058

Please sign in to comment.