diff --git a/CHANGES.md b/CHANGES.md index 1cd5f8f7..8dacd32c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,8 @@ - -- Added ability to delete no-data when `None` is passed to `RasterBand::set_no_data(&mut self, no_data: Option))` +- **Breaking** `RasterBand::set_no_data_value` takes `Option` instead of `f64` so that no _no-data_ can be set. + Also makes it symmetric with `RasterBand::no_data_value` which returns `Option`. - diff --git a/src/raster/rasterband.rs b/src/raster/rasterband.rs index 323b8b7e..6cd7ce46 100644 --- a/src/raster/rasterband.rs +++ b/src/raster/rasterband.rs @@ -432,15 +432,8 @@ impl<'a> RasterBand<'a> { /// Set the no data value of this band. /// - /// See [`set_no_data`](Self::set_no_data) for similar function - /// where _no-data_ can also be deleted. - pub fn set_no_data_value(&mut self, no_data: f64) -> Result<()> { - self.set_no_data(Some(no_data)) - } - - /// Set the no data state of this band. /// If `no_data` is `None`, any existing no-data value is deleted. - pub fn set_no_data(&mut self, no_data: Option) -> Result<()> { + pub fn set_no_data_value(&mut self, no_data: Option) -> Result<()> { let rv = if let Some(no_data) = no_data { unsafe { gdal_sys::GDALSetRasterNoDataValue(self.c_rasterband, no_data) } } else { diff --git a/src/raster/tests.rs b/src/raster/tests.rs index 45cda32c..ba67a2a4 100644 --- a/src/raster/tests.rs +++ b/src/raster/tests.rs @@ -557,9 +557,9 @@ fn test_set_no_data_value() { let dataset = driver.create("", 20, 10, 1).unwrap(); let mut rasterband = dataset.rasterband(1).unwrap(); assert_eq!(rasterband.no_data_value(), None); - assert!(rasterband.set_no_data_value(1.23).is_ok()); + assert!(rasterband.set_no_data_value(Some(1.23)).is_ok()); assert_eq!(rasterband.no_data_value(), Some(1.23)); - assert!(rasterband.set_no_data(None).is_ok()); + assert!(rasterband.set_no_data_value(None).is_ok()); assert_eq!(rasterband.no_data_value(), None); }