Fix method self arguments
MODIFY
src/dataset.rs
src/dataset.rs
@@ -252,7 +252,7 @@ impl Dataset {
}
/// Set the projection reference string for this dataset.
- pub fn set_projection(&self, projection: &str) -> Result<()> {
+ pub fn set_projection(&mut self, projection: &str) -> Result<()> {
let c_projection = CString::new(projection)?;
unsafe { gdal_sys::GDALSetProjection(self.c_dataset, c_projection.as_ptr()) };
Ok(())
@@ -266,7 +266,7 @@ impl Dataset {
#[cfg(major_ge_3)]
/// Set the spatial reference system for this dataset.
- pub fn set_spatial_ref(&self, spatial_ref: &SpatialRef) -> Result<()> {
+ pub fn set_spatial_ref(&mut self, spatial_ref: &SpatialRef) -> Result<()> {
let rv = unsafe { gdal_sys::GDALSetSpatialRef(self.c_dataset, spatial_ref.to_c_hsrs()) };
if rv != CPLErr::CE_None {
return Err(_last_cpl_err(rv));
@@ -328,7 +328,7 @@ impl Dataset {
///
/// Applies to vector datasets, and fetches by the given
/// _0-based_ index.
- pub fn layer(&mut self, idx: isize) -> Result<Layer> {
+ pub fn layer(&self, idx: isize) -> Result<Layer> {
let c_layer = unsafe { gdal_sys::OGR_DS_GetLayer(self.c_dataset, idx as c_int) };
if c_layer.is_null() {
return Err(_last_null_pointer_err("OGR_DS_GetLayer"));
@@ -337,7 +337,7 @@ impl Dataset {
}
/// Fetch a layer by name.
- pub fn layer_by_name(&mut self, name: &str) -> Result<Layer> {
+ pub fn layer_by_name(&self, name: &str) -> Result<Layer> {
let c_name = CString::new(name)?;
let c_layer = unsafe { gdal_sys::OGR_DS_GetLayerByName(self.c_dataset(), c_name.as_ptr()) };
if c_layer.is_null() {
@@ -403,7 +403,7 @@ impl Dataset {
/// y-coordinate of the top-left corner pixel
/// column rotation (typically zero)
/// height of a pixel (y-resolution, typically negative)
- pub fn set_geo_transform(&self, transformation: &GeoTransform) -> Result<()> {
+ pub fn set_geo_transform(&mut self, transformation: &GeoTransform) -> Result<()> {
assert_eq!(transformation.len(), 6);
let rv = unsafe {
gdal_sys::GDALSetGeoTransform(self.c_dataset, transformation.as_ptr() as *mut f64)

MODIFY
src/raster/rasterband.rs
src/raster/rasterband.rs
@@ -208,7 +208,7 @@ impl<'a> RasterBand<'a> {
/// * window - the window position from top left
/// * window_size - the window size (GDAL will interpolate data if window_size != Buffer.size)
pub fn write<T: GdalType + Copy>(
- &self,
+ &mut self,
window: (isize, isize),
window_size: (usize, usize),
buffer: &Buffer<T>,
@@ -253,7 +253,7 @@ impl<'a> RasterBand<'a> {
}
/// Set the no data value of this band.
- pub fn set_no_data_value(&self, no_data: f64) -> Result<()> {
+ pub fn set_no_data_value(&mut self, no_data: f64) -> Result<()> {
let rv = unsafe { gdal_sys::GDALSetRasterNoDataValue(self.c_rasterband, no_data) };
if rv != CPLErr::CE_None {
return Err(_last_cpl_err(rv));

MODIFY
src/vector/layer.rs
src/vector/layer.rs
@@ -87,11 +87,11 @@ impl<'a> Layer<'a> {
FeatureIterator::_with_layer(self)
}
- pub fn set_spatial_filter(&self, geometry: &Geometry) {
+ pub fn set_spatial_filter(&mut self, geometry: &Geometry) {
unsafe { gdal_sys::OGR_L_SetSpatialFilter(self.c_layer, geometry.c_geometry()) };
}
- pub fn clear_spatial_filter(&self) {
+ pub fn clear_spatial_filter(&mut self) {
unsafe { gdal_sys::OGR_L_SetSpatialFilter(self.c_layer, null_mut()) };
}

Fix method self arguments