Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support user data with USINGZ #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Support user data with USINGZ #11

wants to merge 5 commits into from

Conversation

msvbg
Copy link
Contributor

@msvbg msvbg commented Aug 28, 2024

Sister PR to tirithen/clipper2c-sys#6. Adds a usingz cargo feature to support user data in points.

I think the main complication is the double Box dance to be able to pass Rust closures as a C callback. I think this is a nicer API than just a function pointer, which would also leak clipper2c-sys internal types.

Cargo.toml Outdated
@@ -31,3 +32,6 @@ serde_json = "1"
# docs.rs uses a nightly compiler, so by instructing it to use our `doc-images` feature we
# ensure that it will render any images that we may have in inner attribute documentation.
features = ["doc-images"]

[patch.crates-io]
clipper2c-sys = { rev = "210878394637f94bcd3a476bdf24ddf4ba8a39fd", git = "https://github.com/tirithen/clipper2c-sys" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: fix this before merging

@msvbg msvbg force-pushed the usingz branch 3 times, most recently from 1d9fa1f to 72d7dc3 Compare August 28, 2024 14:08
@msvbg
Copy link
Contributor Author

msvbg commented Aug 29, 2024

One problem with this PR is that it breaks e.g. scale_around_point since it uses the Point::new API instead of Point::new_with_z. Maybe the cleanest way to solve this is to have two types, one Point type and a PointZ type or something instead of putting #[cfg(feature = "usingz")] everywhere around the code base.

@songhuaixu
Copy link

songhuaixu commented Sep 3, 2024

One problem with this PR is that it breaks e.g. scale_around_point since it uses the Point::new API instead of Point::new_with_z. Maybe the cleanest way to solve this is to have two types, one Point type and a PointZ type or something instead of putting #[cfg(feature = "usingz")] everywhere around the code base.

I think using PointZ might be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants