georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
322 stars 30 forks source link

Make srid & dim fields of all writers private, and add ctor #156

Open nyurik opened 11 months ago

nyurik commented 11 months ago

As was done in a recently merged here as part of https://github.com/georust/geozero/pull/155 for WktWriter, we need to remove pub on srid and dim fields, making it an internal implementation detail. Instead, there should be an extra writer constructor, e.g. WktWriter::with_opts(&mut out, dialect, dims, srid) that takes all the needed options.

This makes access cleaner, and removes a potential bug of dynamically changing srid or dimensions during processing. Unless of course the writer should support their dynamic modification, but even in that case it should be a function, not external variable access.

cc: @pka @Oreilles