Add comment about futures

pull/3707/head
dull b 2023-07-25 18:06:09 +00:00
parent 3abcce2eec
commit b266b14653
1 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,11 @@ pub type Delete<T> = DeleteStatement<<T as HasTable>::Table, <T as IntoUpdateTar
pub type Find<'a, T> = dsl::Find<<T as HasTable>::Table, <T as Crud<'a>>::IdType>;
// When using `RunQueryDsl::execute`, directly building futures with `Box::pin` and `TryFutureExt::and_then`
// instead of `async` + `await` fixes weird compile errors.
// https://github.com/rust-lang/rust/issues/102211
// When using `RunQueryDsl::first`, `async` + `await` works, and it must be used otherwise the closure for `and_then`
// will both own `conn` and return a future that references it.
#[async_trait]
pub trait Crud<'a>
where