跳到主要内容
CodeWiki
练习
学习路径
学习方向
速查表
试验场
术语表
AI时代
搜索
⌘K
English
中文
练习
学习路径
学习方向
速查表
试验场
术语表
AI时代
English
中文
练习
/
测验
/
Rust
/
Pin与Unpin
Future::poll为什么用Pin<&mut Self>接收self?
来自Pin与Unpin
Rust 1.98
进阶
1分钟
Future::poll为什么用Pin<&mut Self>接收self?
它让所有future实现都能依赖轮询之间的地址稳定性,包括具有地址敏感状态的实现。
每个future都必然自引用并分配在堆上。
Pin会自动唤醒处于pending状态的future。
该接收者会让每个future实现Unpin。
检查
向AI询问这道练习
报告错误
下一道练习
把Pin<Box<T>> 绑定移动到另一个变量时会发生什么?
测验
有新版本可用
重新加载