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 up| ^^^^ the trait `diesel::Connection` is not implemented for `std::result::Result<diesel::sqlite::SqliteConnection, diesel::ConnectionError>` #581
Comments
This comment has been minimized.
|
You need to unwrap the result or handle the possible error. |
sgrif
closed this
Jan 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adals commentedJan 18, 2017
hello
here is my code i got error
#![feature(plugin)]
#![plugin(rocket_codegen)]
#![feature(proc_macro)]
extern crate rocket;
#[macro_use] extern crate rocket_contrib;
#[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_codegen;
pub mod schema;
pub mod models;
use diesel::prelude::;
use diesel::sqlite::SqliteConnection;
use models::;
use rocket_contrib::Template;
use std::result::*;
#[get("/")]
fn index() -> Template {
use schema::users::dsl::*;
let sqlconn=SqliteConnection::establish("dddd.db");
let results = users.filter(published.eq(true))
.limit(5)
.load::(&sqlconn);
let aa="";
}
fn main() {
rocket::ignite().mount("/", routes![index]).launch()
}
/Users/adelalharbi/.cargo/bin/cargo run --color=always
Compiling accountant v0.1.0 (file:///Users/adelalharbi/Codes/Rust/Accountant)
error[E0277]: the trait bound
std::string::String: diesel::types::FromSqlRow<diesel::types::Nullable<diesel::types::Bool>, _>is not satisfied--> src/main.rs:29:10
|
29 | .load::(&sqlconn);
| ^^^^ the trait
diesel::types::FromSqlRow<diesel::types::Nullable<diesel::types::Bool>, _>is not implemented forstd::string::String|
= help: the following implementations were found:
<std::string::String as diesel::types::FromSqlRow<diesel::types::Text, DB>>
<std::string::String as diesel::types::FromSqlRow<diesel::types::Date, DB>>
<std::string::String as diesel::types::FromSqlRow<diesel::types::Time, DB>>
<std::string::String as diesel::types::FromSqlRow<diesel::types::Timestamp, DB>>
= note: required because of the requirements on the impl of
diesel::types::FromSqlRow<(diesel::types::Integer, diesel::types::Nullable<diesel::types::Bool>), _>for(i32, std::string::String)= note: required because of the requirements on the impl of
diesel::Queryable<(diesel::types::Integer, diesel::types::Nullable<diesel::types::Bool>), _>formodels::Usererror[E0277]: the trait bound
std::result::Result<diesel::sqlite::SqliteConnection, diesel::ConnectionError>: diesel::Connectionis not satisfied--> src/main.rs:29:10
|
29 | .load::(&sqlconn);
| ^^^^ the trait
diesel::Connectionis not implemented forstd::result::Result<diesel::sqlite::SqliteConnection, diesel::ConnectionError>error: aborting due to 2 previous errors
error: Could not compile
accountant.To learn more, run the command again with --verbose.