-
Notifications
You must be signed in to change notification settings - Fork 28
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
no method named union
found
#22
Comments
Looks like you need to use As mentioned in #16, we may have to make a few adjustments for version 0.5.x. But to be honest, it is not immediately clear to me what exactly it is that has changed in geo-types that causes this compiler error. It is confusing that cargo says it can compile To the Rust experts: Does Rust swallow the compile error because everything is generic? Is there a way to make such problems more explicit? |
I'm new to rust but maybe something like "^0.4" could work to prevent the lib from compiling with newer versions? I've made it compile by changing geo-types version as you suggested but I also had to downgrade geo & geojson versions... |
FYI I have asked a question about that on SO. It looks like this is a weak point in cargo's dependency handling when extending a base type with an addon trait, expressed by the sarcastic comment:
|
I ran into this issue when trying to use the 0.7 branch of geo-types. Basically, geo-types 0.6.2 works with booleanop 0.3.2. And geo-types 0.4.0 works with booleanop 0.2.2. Specifying other combinations fails with same error as the OP about Per this SO, I think I have a work-around. Assume you want to use the 0.7 branch of geo-types, either directly or because some other crate depends on it. In the Cargo.toml, alias the older 0.6 branch, and then use that alias explicitly when you want to use booleanop. Cargo.toml:
Rust code: use old_geo_types::{Polygon, polygon};
use geo_booleanop::boolean::BooleanOp;
fn main() {
let big: Polygon<f64> = polygon![
(x: 416., y: 256.),
(x: 432., y: 240.),
(x: 432., y: 224.),
(x: 448., y: 280.),
(x: 480., y: 208.),
(x: 480., y: 256.),
];
let small: Polygon<f64> = polygon![
(x: 400., y: 272.),
(x: 416., y: 256.),
(x: 480., y: 256.),
(x: 480., y: 272.),
];
let union = small.union(&big);
for p in union.into_iter() {
dbg!(p);
}
} This seems to work, assuming:
This seems easier than recompiling booleanop to work with newer versions of geo-types! Hope it helps. |
I'm getting this error. I've tried both 0.2.1 and 0.1.4
Clone and build this repo to reproduce https://github.com/inclooder/rust-geo-test
The text was updated successfully, but these errors were encountered: