You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to compile this simple program from your example:
#![allow(unused)]
#![allow(dead_code)]
extern crate chrono;
extern crate rusqlite;
#[macro_use]
extern crate tql;
#[macro_use]
extern crate tql_macros;
use rusqlite::Connection;
use tql::PrimaryKey;
use chrono::Utc;
use chrono::DateTime;
#[derive(SqlTable)]
struct Model {
id: PrimaryKey,
text: String,
date_added: DateTime<Utc>
}
fn get_connection() -> Connection {
Connection::open("database.db").unwrap()
}
fn main() {
let connection = get_connection();
let _ = sql!(connection, Model.create());
// Insert a row in the table.
let text = String::new();
let date_added = Utc::now();
let id = sql!(connection, Model.insert(text = text, date_added = date_added)).unwrap();
}
I got the following type conversion error message:
>> cargo run
Compiling updater_tql v0.1.0 (file:///C:/Users/tembo/Desktop/qnd/updater_tql)
error[E0277]: the trait bound `rusqlite::types::ToSqlOutput<'_>: std::convert::From<&std::string::String>` is not satisfied
--> src\main.rs:41:14
|
41 | let id = sql!(connection, Model.insert(text = text, date_added = date_added)).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<&std::string::String>` is not implemented for `rusqlite::types::ToSqlOutput<'_>`
|
= help: the following implementations were found:
<rusqlite::types::ToSqlOutput<'a> as std::convert::From<&'a T>>
<rusqlite::types::ToSqlOutput<'a> as std::convert::From<T>>
= note: required because of the requirements on the impl of `std::convert::Into<rusqlite::types::ToSqlOutput<'_>>` for `&std::string::String`
= note: required because of the requirements on the impl of `rusqlite::types::ToSql` for `&std::string::String`
= note: required for the cast to the object type `rusqlite::types::ToSql`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error[E0277]: the trait bound `rusqlite::types::ToSqlOutput<'_>: std::convert::From<&chrono::DateTime<chrono::Utc>>` is not satisfied
--> src\main.rs:41:14
|
41 | let id = sql!(connection, Model.insert(text = text, date_added = date_added)).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<&chrono::DateTime<chrono::Utc>>` is not implemented for `rusqlite::types::ToSqlOutput<'_>`
|
= help: the following implementations were found:
<rusqlite::types::ToSqlOutput<'a> as std::convert::From<&'a T>>
<rusqlite::types::ToSqlOutput<'a> as std::convert::From<T>>
= note: required because of the requirements on the impl of `std::convert::Into<rusqlite::types::ToSqlOutput<'_>>` for `&chrono::DateTime<chrono::Utc>`
= note: required because of the requirements on the impl of `rusqlite::types::ToSql` for `&chrono::DateTime<chrono::Utc>`
= note: required for the cast to the object type `rusqlite::types::ToSql`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
error: Could not compile `updater_tql`.
To learn more, run the command again with --verbose.
Were you able to run your example without these kind of errors?
The text was updated successfully, but these errors were encountered:
I'm trying to compile this simple program from your example:
I got the following type conversion error message:
Were you able to run your example without these kind of errors?
The text was updated successfully, but these errors were encountered: