error[E0277]: the trait bound `uuid::Uuid: diesel::Queryable<diesel::sql_types::Uuid, _>` is not satisfied --> src/models.rs:45:14 | 45 | .load::<App>(conn) | ^^^^ the trait `diesel::Queryable<diesel::sql_types::Uuid, _>` is not implemented for `uuid::Uuid` | = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Uuid, diesel::sql_types::Text), _>` for `(uuid::Uuid, std::string::String)` = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Uuid, diesel::sql_types::Text), _>` for `models::App` = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<_, models::App>` for `diesel::query_builder::SelectStatement<schema::app::table, dies el::query_builder::select_clause::DefaultSelectClause, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query _builder::order_clause::NoOrderClause, diesel::query_builder::limit_clause::LimitClause<diesel::expression::bound::Bound<diesel::sql_types::BigInt, i64>>>`
代码如下:
Cargo.toml:
1 2 3
[dependencies] diesel = { version = "1.4.2", features = ["postgres", "uuid"] } uuid = { version = "0.7.4", features = ["v4"] }
uuid = { version = ">=0.2.0, <0.7.0", optional = true, features = ["use_std"] }
而我在项目中使用的 uuid 为 0.7.4. 尝试将 uuid 降级到 0.6.
上述问题不再报错, 不过有一个新的报错出现:
1 2 3 4 5
error[E0599]: no method named `to_simple` found for type `uuid::Uuid` in the current scope --> src/models.rs:37:45 | 37 | let claims = create_claims(&self.id.to_simple().to_string()); | ^^^^^^^^^ help: there is a method with a similar name: `simple`