-
Notifications
You must be signed in to change notification settings - Fork 42
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
try_into() not working: the trait bound geos::Geometry<'_>: From<&geo_types::MultiPolygon<f64>>
is not satisfied
#90
Comments
Try: use geo::{MultiPolygon};
use std::convert::TryInto;
use geos::{Geometry as GGeometry};
#[derive(Clone, Debug)]
pub struct GeomAndId {
pub geom: MultiPolygon<f64>,
pub id: u128, // TODO: use core.Id etc.
}
impl GeomAndId {
pub fn geos_geom<'a>(&'a self) -> Result<GGeometry<'a>, StringError> {
let g: GGeometry = self.geom.try_into().map_err(|e| {
format!("Geometry could not be converted to GEOS: {}", e).into()
})?;
Ok(g)
}
} ? |
@GuillaumeGomez basically removing the |
That's not the only thing which changed... |
@GuillaumeGomez hmmm no dice... same error
|
Ok, found the issue... We should add a [dependencies]
geos = { version = "8.0", features = ["geo"] } That fixes the issue. Wanna send a PR for the missing doc annotations? |
Sure thing thanks |
I'm currently stumped on a weird borrow checker error, I know it's not relevant to this issue but @GuillaumeGomez if you have seen this would appreciate any help. I posted it in Rust help cuz I'm not sure it's a geos issue. thanks |
From what I saw, you're passing a temporary slice to a function while saying that the lifetime of the temporary slice is the same as the one of the |
I must be doing something dumb.
Rust 2018 edition, Geos v8.0.1
Code:
Error:
It seems like somehow using try_into() is causing it to want the From trait, but clearly according to docs, the Geos
TryFrom<&'a MultiPolygon<f64>
trait exists, so what gives? Any help appreciated, thanks.The text was updated successfully, but these errors were encountered: