georaster icon indicating copy to clipboard operation
georaster copied to clipboard

Reading requires mutability?

Open justmytwospence opened this issue 11 months ago • 1 comments

Hi I'm brand spanking new to memory management. It seems to make things difficult unnecessarily that using read_pixel requires mutability. Is there a reason this is the case that I'm not understanding?

justmytwospence avatar Jan 14 '25 16:01 justmytwospence

Fair question. Since the reader state is stored directly in the reader struct, internal data (read position, data buffer) is updated when reading. That said, Rust has a pattern called "interior mutability" to hide internal mutations. PR welcome...

pka avatar Jan 16 '25 07:01 pka