Closed kylebarron closed 5 months ago
Is there a simple way with lifetimes to fix this temporary value dropped while borrowed error? It's on this line. I'm not sure if this is an issue with the trait design or implementation or with my code
When I run into situations like this, I typically start incrementally loosening lifetime bounds that don't need to be explicitly specified. With these changes, your code compiles: https://gist.github.com/frewsxcv/75e719227b889ee2930ccb59930b26de
When I run into situations like this, I typically start incrementally loosening lifetime bounds that don't need to be explicitly specified. With these changes, your code compiles: gist.github.com/frewsxcv/75e719227b889ee2930ccb59930b26de
Thanks! That was helpful! I was able to make some progress. But it seems like the trait methods that really need &'a self
are the iterators.
So I can make progress by removing 'a
everywhere but that forces me to write ugly code and avoid using the iterators, doing stuff like
for polygon_idx in 0..geom.num_polygons() {
Especially with the GeometryCollection
and Geometry
traits, it gets complex and it's not clear to me we can fully remove the lifetimes.
I tried to implement unsigned_area_geometry
which takes anything that implements GeometryTrait
, but there as_type
requires 'a
.
From what I understand, https://github.com/georust/geo/pull/1115 is a newer version of this so I'm going to close this one. Feel free to reopen if this is wrong
Change list
Send + Sync
restriction onT
on the trait. I don't know whether this restriction makes sense here. I originally added it because rust-postgis included it. But it appeared thatCoordFloat
doesn't include those trait bounds so it was easier in this context to remove them.T: CoordNum
on each trait, and define other item types in terms ofT
. I needed to do this so that some algorithms could enforceCoordFloat
and not justCoordNum
. I'm not sure iftype ItemType = LineString<Self::T>;
on theimpl
is necessary instead oftype ItemType = LineString<T>;
.Questions:
temporary value dropped while borrowed
error? It's on this line. I'm not sure if this is an issue with the trait design or implementation or with my code