You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there exists just geo::Geo, which is a structure containing owned data. I propose we rename this to geo::GeoBuf and introduce a new structure containing borrowed data called geo::Geo. Table of similar analogies:
Currently, if there exists a method centerpoint on Geo, and I want to apply this operation on a Wkt struct (from rust-wkt), I have to convert my Wkt struct to a Geo, and since Geo is owned, this results in memory allocations occurring.
With my proposal above, we would just need to interpret the Wkt struct as the new borrowedGeo, which results in a Geo struct that references the existing data in the Wkt struct, resulting in no new memory allocations.
Implementation
struct Geo will be renamed to struct GeoBuf
struct Geo will be a new struct with borrowed fields. Not too sure how this will look right now, but it's do-able.
Deref<Target=Geo> will be implemented on GeoBuf
The text was updated successfully, but these errors were encountered:
frewsxcv
changed the title
Proposal: Introduce geo::GeoBuf struct, alter geo::Geo truct
Proposal: Introduce geo::GeoBuf struct, alter geo::Geo struct
Mar 9, 2016
Just curious, is there still interest in this? Is there a way today to use geo geometries from borrowed data? Or is the thought that in the long term geo traits will hopefully solve this use case?
Idea
Currently, there exists just
geo::Geo
, which is a structure containing owned data. I propose we rename this togeo::GeoBuf
and introduce a new structure containing borrowed data calledgeo::Geo
. Table of similar analogies:Vec
slice
String
str
PathBuf
Path
GeoBuf
Geo
Reasoning
Currently, if there exists a method
centerpoint
onGeo
, and I want to apply this operation on aWkt
struct (from rust-wkt), I have to convert myWkt
struct to aGeo
, and sinceGeo
is owned, this results in memory allocations occurring.With my proposal above, we would just need to interpret the
Wkt
struct as the new borrowedGeo
, which results in aGeo
struct that references the existing data in theWkt
struct, resulting in no new memory allocations.Implementation
struct Geo
will be renamed tostruct GeoBuf
struct Geo
will be a new struct with borrowed fields. Not too sure how this will look right now, but it's do-able.Deref<Target=Geo>
will be implemented onGeoBuf
The text was updated successfully, but these errors were encountered: