Dataset::rasterband
doesn't follow Rust mutable reference rules. #450
Open
Description
Currently, the following compiles, but the test fails:
#[test]
fn test_mut() {
let dataset = Dataset::open(fixture("tinymarble.tif")).unwrap();
let b1 = dataset.rasterband(1).unwrap();
let before_desc = b1.description().unwrap();
{
let mut also_b1 = dataset.rasterband(1).unwrap();
// Arbitrary mutation
also_b1.set_description("smash").unwrap();
}
let after_desc = b1.description().unwrap();
assert_eq!(before_desc, after_desc);
}
Given we never request a mutable reference to Dataset
, one could argue you should never be able to get a mutable reference to an owned, constituent component of the Dataset
, as we have done here.
Metadata
Assignees
Labels
No labels