async rust 相关

  • red (async) function, blue (sync) function
  • #[tokio::main(flavor = "current_thread")]tokio 只用单线程运行时.
  • Future::pollawait 时第一次运行, 然后需要调用 wake() 方法告诉运行时再次调用.
  • poll 中调用其他 Future 对象的 poll 方法.
    1. 将其 Box::pin
    2. futures::FutureExt 扩展的 poll_unpin 方法
    3. Pin::new(T) where T: Unpin
  • Pin<T> trait

https://fasterthanli.me/articles/pin-and-suffering

keep learning
原文地址:https://www.cnblogs.com/wbin91/p/14595348.html