djc / bb8

Full-featured async (tokio-based) postgres connection pool (like r2d2)
MIT License
753 stars 110 forks source link

error: the trait bound `tokio_postgres::NoTls: #53

Closed kushwahashiv closed 4 years ago

kushwahashiv commented 4 years ago
[package]
name = "db_pool"
version = "0.1.0"
edition = "2018"

[dependencies]
bb8 = "0.3.1"
bb8-postgres = "0.3.1"
diesel = { version = "1.4.3", features = ["postgres", "extras"] }
failure = "0.1"
futures = "0.1"
futures-state-stream = "0.2"
postgres = "0.17.0"
tokio-postgres = "0.5.1"
use bb8;
use bb8_postgres;
use futures::future;
use futures::prelude::*;
use tokio_postgres;
use tokio_postgres::NoTls;

#[derive(Clone, Debug)]
pub struct Pool {
    inner: bb8::Pool<bb8_postgres::PostgresConnectionManager<NoTls>>
}

impl From<bb8::Pool<bb8_postgres::PostgresConnectionManager<NoTls>>> for Pool {
    fn from(v: bb8::Pool<bb8_postgres::PostgresConnectionManager<NoTls>>) -> Self {
        Self { inner: v }
    }
}

I am getting following error:

error: the trait bound `tokio_postgres::NoTls: bb8_postgres::tokio_postgres::tls::MakeTlsConnect<bb8_postgres::tokio_postgres::Socket>` is not satisfied
label: the trait `bb8_postgres::tokio_postgres::tls::MakeTlsConnect<bb8_postgres::tokio_postgres::Socket>` is not implemented for `tokio_postgres::NoTls`

image

djc commented 4 years ago

You have a version mismatch going on. You need to use bb8 from master to be able to use tokio-postgres 0.5 (I hope to release a new version of bb8 soon).