Cargo check reporting missing trait implementation

Noob alert:

I want to add GeometryPoint Implementation to quek/arysn library.

The code is in this gist

I get error saying

  --> arysn/src/
44 |         ToSql::to_sql(&geo_types::Point::new(self.0.clone().x,self.0.clone().y), ty, out)
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `tokio_postgres::types::ToSql` is not implemented for `geo_types::Point<f64>`

I've checked This trait is implemented for this type as mentioned in documentation.

Does anyone know why is it so?

Thank you

From the docs of tokio_postgres:

In addition, some implementations are provided for types in third party crates. These are disabled by default; to opt into one of these implementations, activate the Cargo feature corresponding to the crate's name prefixed by with- . For example, the with-serde_json-1 feature enables the implementation for the serde_json::Value type.

As states you will need to activate that feature in your Cargo.toml:

tokio-postgres = { version = "0.5", features = ["with-geo-types"] }

So try enabling the with-geo-types-0_6 features for postgres:

postgres = { version = "...", features = ["with-geo-types-0_6", ] }
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.