georust / proj

Rust bindings for the latest stable release of PROJ
https://docs.rs/proj
Apache License 2.0
137 stars 45 forks source link

Refactor PROJ thread context handling #76

Closed frewsxcv closed 3 years ago

frewsxcv commented 3 years ago

This pull request contains a new opaque struct ThreadContext that contains all thread context handling.

One benefit of this is the Drop implementations for Proj and ProjBuilder no longer need to handle destroying the thread context since that's now handled by the Drop implementation for ThreadContext. Also, ThreadContext now implements Clone, which gets us one step closer to implementing Clone for Proj. I chose the ThreadContext name because it's a little more descriptive than Context and the PROJ docs call this concept a "thread context". I created a separate file for it because I noticed proj.rs is getting on the larger side.

urschrei commented 3 years ago

Bors try

bors[bot] commented 3 years ago

try

Build succeeded:

frewsxcv commented 3 years ago

Closing this for now. I don't have a great solution for the issue @michaelkirk brought up, and no longer feeling confident in this strategy.