Skip to content

Commit 520c17d

Browse files
committed
Move Buffer/ByteBuffer to raster::types
1 parent 5772b02 commit 520c17d

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

src/raster/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ pub use mdarray::{
8686
Attribute, Dimension, ExtendedDataType, ExtendedDataTypeClass, Group, MDArray, MdStatisticsAll,
8787
};
8888
pub use rasterband::{
89-
Buffer, ByteBuffer, CmykEntry, ColorEntry, ColorInterpretation, ColorTable, GrayEntry,
90-
HlsEntry, PaletteInterpretation, RasterBand, RgbaEntry, StatisticsAll,
91-
StatisticsMinMax,
89+
CmykEntry, ColorEntry, ColorInterpretation, ColorTable, GrayEntry, HlsEntry,
90+
PaletteInterpretation, RasterBand, RgbaEntry, StatisticsAll, StatisticsMinMax,
9291
};
9392
pub use rasterize::{rasterize, BurnSource, MergeAlgorithm, OptimizeMode, RasterizeOptions};
94-
pub use types::{AdjustedValue, GdalDataType, GdalType, ResampleAlg};
93+
pub use types::{AdjustedValue, Buffer, ByteBuffer, GdalDataType, GdalType, ResampleAlg};
9594
pub use warp::reproject;
9695

9796
/// Key/value pair for passing driver-specific creation options to

src/raster/rasterband.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::dataset::Dataset;
22
use crate::gdal_major_object::MajorObject;
33
use crate::metadata::Metadata;
4-
use crate::raster::{GdalDataType, GdalType, ResampleAlg};
4+
use crate::raster::{Buffer, GdalDataType, GdalType, ResampleAlg};
55
use crate::utils::{_last_cpl_err, _last_null_pointer_err, _string};
66
use gdal_sys::{
77
self, CPLErr, GDALColorEntry, GDALColorInterp, GDALColorTableH, GDALComputeRasterMinMax,
@@ -705,19 +705,6 @@ impl<'a> MajorObject for RasterBand<'a> {
705705

706706
impl<'a> Metadata for RasterBand<'a> {}
707707

708-
pub struct Buffer<T: GdalType> {
709-
pub size: (usize, usize),
710-
pub data: Vec<T>,
711-
}
712-
713-
impl<T: GdalType> Buffer<T> {
714-
pub fn new(size: (usize, usize), data: Vec<T>) -> Buffer<T> {
715-
Buffer { size, data }
716-
}
717-
}
718-
719-
pub type ByteBuffer = Buffer<u8>;
720-
721708
/// Represents a color interpretation of a RasterBand
722709
#[derive(Debug, PartialEq, Eq)]
723710
pub enum ColorInterpretation {

src/raster/types.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,19 @@ impl ResampleAlg {
446446
}
447447
}
448448

449+
pub struct Buffer<T: GdalType> {
450+
pub size: (usize, usize),
451+
pub data: Vec<T>,
452+
}
453+
454+
impl<T: GdalType> Buffer<T> {
455+
pub fn new(size: (usize, usize), data: Vec<T>) -> Buffer<T> {
456+
Buffer { size, data }
457+
}
458+
}
459+
460+
pub type ByteBuffer = Buffer<u8>;
461+
449462
#[cfg(test)]
450463
mod tests {
451464
use super::*;

0 commit comments

Comments
 (0)