Re:First Rust Code Shows Up in the Windows 11 Kernel
by qaq on Saturday May 13, 2023 @03:46AM
(#35926466)
I am saying that in web services you will frequently use async functions that
look like async fn do_blah(db_repo: impl DBRepo ...) {...} and are executed on
async-std or Tokio
[ Parent
| on HN ]
Re:First Rust Code Shows Up in the Windows 11 Kernel
by hgomersall on Saturday May 13, 2023 @06:19AM
(#35927058)
That will work. It only needs the additional bounds if you want to spawn that as a new task.
Re:First Rust Code Shows Up in the Windows 11 Kernel
by qaq on Saturday May 13, 2023 @06:52AM
(#35927200)
so if I am doing async calls on DBRepo inside that function they can not be moved to a different thread by a runtime like tokio?
Re:First Rust Code Shows Up in the Windows 11 Kernel
by jen20 on Saturday May 13, 2023 @09:01AM
(#35927966)
One would typically not spawn those - as I understand it you need the type constraints if calling “tokio::spawn” (or some equivalent) but not if simply calling an async function in the same task.