Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upthe trait bound `r2d2::PooledConnection<r2d2_diesel::ConnectionManager<diesel::pg::PgConnection>>: diesel::Connection` is not satisfied #339
Comments
This comment has been minimized.
|
r2d2-diesel is using the latest released version, while your code is using the version from git. You can manually override it with |
sgrif
closed this
May 21, 2016
This comment has been minimized.
xiaofann
commented
May 23, 2016
|
forget use deref trait. just add operator * behind & like (&*connection) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xiaofann commentedMay 21, 2016
use r2d2-diesel = {git = "https://github.com/diesel-rs/r2d2-diesel"} for thread pool, when i cargo build have the error message.
the trait bound
r2d2::PooledConnection<r2d2_diesel::ConnectionManager<diesel::pg::PgConnection>>: diesel::Connectionis not satisfiedlib version info:
dependencies = [
"diesel 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel_codegen 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2-diesel 0.6.0 (git+https://github.com/diesel-rs/r2d2-diesel)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
source:
![feature(custom_derive, custom_attribute, plugin)]
![plugin(diesel_codegen)]
[macro_use]extern crate diesel;
extern crate r2d2;
extern crate r2d2_diesel;
[macro_use]extern crate lazy_static;
extern crate rustc_serialize;
extern crate toml;
use diesel::pg::PgConnection;
use r2d2_diesel::ConnectionManager;
use diesel::prelude::*;
use models::Order;
pub mod config;
pub mod models;
pub mod schema;
fn main() {
let config = r2d2::Config::builder().pool_size(config::POOL_SIZE).build();
let manager = ConnectionManager::::new(config::DATABASE_URL.as_str());
let pool = r2d2::Pool::new(config, manager).expect("Failed to create poll");
let connection = pool.get().unwrap();
use self::schema::order::dsl::;
}