Calling a method with `TryFrom<T>` but getting `From<T>` not implemented error

I'm trying to use spatial-join crate (I see it's not updated for 2 years, but whatever). Simple code from an example doesn't work.

In the docs, struct Config has method serial:

pub fn serial<T, U>(self, small: T) -> Result<SpatialIndex, Error> where
    T: TryInto<SplitGeoSeq, Error = U>,
    U: Any, 

and SplitGeoSeq has trait impl:

impl TryFrom<Vec<Point<f64>>> for SplitGeoSeq

So, my test code is this:

# [dependencies]
# geo = "0.23"
# spatial-join = "0.1"

use geo::geometry::Point;
use spatial_join::Config;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut stops_points = Vec::<Point<f64>>::new();

    stops_points.push(Point::new(76.9, 43.2));
    stops_points.push(Point::new(92.9, 56.0));
    stops_points.push(Point::new(104.3, 52.3));

    let idx = Config::new().serial(stops_points)?;

And the error says Vec<Point<f64>> must implement From, not TryFrom.

I'm puzzled, what's wrong? Actually, crate's own example doesn't compile in my rustc 1.61, with the same message:

13 |     let idx = Config::new().serial(stops_points)?;
   |                             ^^^^^^ the trait `From<Vec<geo::Point>>` is not implemented for `SplitGeoSeq`
   = note: required because of the requirements on the impl of `Into<SplitGeoSeq>` for `Vec<geo::Point>`
   = note: required because of the requirements on the impl of `TryFrom<Vec<geo::Point>>` for `SplitGeoSeq`
note: required by a bound in `Config::serial`
  --> ~/.cargo/registry/src/
59 |         T: TryInto<SplitGeoSeq, Error = U>,
   |                                 ^^^^^^^^^ required by this bound in `Config::serial`

spatial-join is using geo = "0.14" which is incompatible with the version you selected. Changing the dependency on geo to 0.14 fixes the error for me

1 Like