I'm using the mysql crate, specifically the query_first method. Running the following snippet compiled perfectly.
let foo : mysql::Result<Option<u64>> = tx.query_first("SELECT row_count();");
For ergonomic purposes, I want to embed that call at the top-level of a match, so that I can test multiple cases. To infer the missing type, I use the turbofish operator (see following snippet). However, that does not compile.
match tx.query_first::<mysql::Result<Option<u64>>>("SELECT row_count();") {
Ok(Some(num)) => {}
Ok(None) => {}
Err(e) => {}
};
Am I not using turbofish correctly?
The compiler errors are:
error[E0107]: wrong number of type arguments: expected 2, found 1
--> src/main.rs:224:22
|
224 | match tx.query_first::<mysql::Result<Option<u64>>>("SELECT row_count();") {
| ^^^^^^^^^^^ expected 2 type arguments
error[E0277]: the trait bound `std::result::Result<std::option::Option<u64>, mysql::error::Error>: mysql_common::value::convert::FromValue` is not satisfied
--> src/main.rs:224:22
|
224 | match tx.query_first::<mysql::Result<Option<u64>>>("SELECT row_count();") {
| ^^^^^^^^^^^ the trait `mysql_common::value::convert::FromValue` is not implemented for `std::result::Result<std::option::Option<u64>, mysql::er
ror::Error>`
|
= note: required because of the requirements on the impl of `mysql_common::row::convert::FromRow` for `std::result::Result<std::option::Option<u64>, mysql::error::Err
or>`