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 upDiesel error type on Sql_Count #1876
Comments
This comment has been minimized.
|
As far as I can see from that minimal code snippet, the problem seems to be that you use the result only in the print statement. Therefore rustc could not infer the concrete type of To make this work there are two solutions:
(Closed this issue because our issue tracker should only contain actionable open issues. Feel free to ask such questions in our gitter channel or our forum |
weiznich
closed this
Oct 5, 2018
This comment has been minimized.
NachoGotaki
commented
Oct 5, 2018
|
thank you too much. |
NachoGotaki commentedOct 5, 2018
Hello, first of all i have to say that im totally new in rust/rocket/diesel. Completely new.
Im only trying to print the total of rows in a query. Im doing this.
let total_results = places::table.count().load(connection); println!("{:?}", total_results);Im trying to get the total to do a paginator, but compilation fails due to this:
error[E0282]: type annotations needed
--> src/v1/places/mod.rs:189:47
|
189 | let total_results = places::table.count().load(connection);
| ------------- ^^^^ cannot infer type for
U| |
| consider giving
total_resultsa typeAnd in examples i see on the web they never give a type to the variable.
https://docs.diesel.rs/diesel/query_dsl/trait.QueryDsl.html#method.count
Thank in advance