Rust Pin

Rust Pin

(Jin Qing's Column, Sep., 2024)

From: https://doc.rust-lang.org/std/pin/index.html

Rust can pin data location in memory, that means its address can not be changed.

Pinned data guarantees the memory location is always valid.

Safe code can not move pinned data to another location.

Safe code users do not need to care about Pin.

  • What's moving
    • copy + ownership
    • all values are movable
      • assignment or function parameter
      • mem::replace
  • What's pinning
    • until drop
  • Address sensitivity
    • some interface is relay on pinned state
    • self-referenced type: Future
    • leverage the type system
      • Pin
    • how Pin works
      • restrict access to Ptr
    • PhantomPinned
  • Example types
    • self-referential struct
    • intrusive list
  • Drop
  • Projection and Structural Pinning
相关推荐
WZF-Sang1 小时前
Linux权限理解【Shell的理解】【linux权限的概念、管理、切换】【粘滞位理解】
linux·运维·服务器·开发语言·学习
_Power_Y1 小时前
JavaSE:11、内部类
java·开发语言
你可以自己看1 小时前
python的基础语法
开发语言·python
爱编程的小新☆1 小时前
C语言内存函数
c语言·开发语言·学习
尘浮生2 小时前
Java项目实战II基于Spring Boot的宠物商城网站设计与实现
java·开发语言·spring boot·后端·spring·maven·intellij-idea
勤奋的小王同学~2 小时前
怎么修改mvn的java版本
java·开发语言
doc_wei2 小时前
Java小区物业管理系统
java·开发语言·spring boot·spring·毕业设计·课程设计·毕设
三玖诶3 小时前
在 Qt 中使用 QLabel 设置 GIF 动态背景
开发语言·qt·命令模式
繁依Fanyi3 小时前
828华为云征文|华为Flexus云服务器搭建OnlyOffice私有化在线办公套件
服务器·开发语言·前端·python·算法·华为·华为云
邂逅自己3 小时前
Java入门程序-HelloWorld
java·开发语言