mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-31 01:30:00 +00:00
Add comment about futures
This commit is contained in:
parent
3abcce2eec
commit
b266b14653
1 changed files with 5 additions and 0 deletions
|
@ -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>;
|
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]
|
#[async_trait]
|
||||||
pub trait Crud<'a>
|
pub trait Crud<'a>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue