Skip to content

v0.101.0 - Async fixes

Choose a tag to compare

@LimitLost LimitLost released this 21 Feb 15:08

Goal of this release - Fix errors:

  • implementation of std::marker::Send is not general enough
    std::marker::Send would have to be implemented for the type &str
    ...but std::marker::Send is actually implemented for the type &'0 str, for some specific lifetime '0
  • implementation of sqlx::Executor is not general enough
    sqlx::Executor<'_> would have to be implemented for the type &mut sqlx::PgConnection
    ...but sqlx::Executor<'0> is actually implemented for the type &'0 mut sqlx::PgConnection, for some specific lifetime '0

happens when query! is used inside of tokio::spawn requiring the future to be Send + 'static

Changes:

  • async-trait dependency added to library and used on the ToConvert trait (to fix error above)
  • Added test coverage for tokio::spawn, generic executor arguments, and sqlx Pool argument handling.
  • EasyExecutor is now implemented for both &mut and non &mut Connection and Transaction
  • Removed requirement of &mut for connection passed into query! macro, now it's optional, (since inside of the macro both &mut and & are added automatically where needed, this is mentioned in the documentation)
  • PoolTransaction was added into Easy SQL and it's returned from Database::transaction() of both Sqlite and Postgres, required to fix the errors mentioned above, when using easy_sql::Transaction specifically
  • into_executor method was split out of EasyExecutor into EasyExecutorInto trait, automatically implemented for every mutable reference implementing EasyExecutor and implemented manually for sqlx Types implementing sqlx::Executor (because into_executor can't be implemented for non references of Connection and Transaction)
  • fetch_mut was removed from struct generated by query_lazy! since, after the changes above, it accepted the exact same input as fetch
  • fetch from query_lazy! now requires for the input to implement EasyExecutorInto instead of EasyExecutor
  • generate-readme feature was hidden from the documentation (renamed into _generate_readme)