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
相关推荐
zh_xuan几秒前
c++ 23 std::out_ptr用法
开发语言·c++23·out_ptr
陆卿之16 分钟前
Java对接DeepSeek
java·开发语言·人工智能
庄园特聘拆椅狂魔17 分钟前
Java 后端转全栈的第一课:从前端项目搭建到技术选
java·开发语言·前端
Wx-bishekaifayuan1 小时前
springboot生活易购超市管理系统54086-计算机课程设计、毕业设计
spring boot·后端·python·django·课程设计·express·旅游
lizhongxuan1 小时前
VirtIO:虚拟机的磁盘、网络与内存是怎样工作的
后端
weixin_307779131 小时前
C++代码实现MATLAB中的pade函数功能
开发语言·c++·算法·matlab
ProcessOn官方账号1 小时前
java IO操作 你快速认识IO的相关基本知识
java·开发语言
计算机毕设定制辅导-无忧学长1 小时前
《基于Spring Boot的减脂轻食购物网站》
java·vue.js·spring boot·后端·减脂轻食购物网站
神仙别闹1 小时前
基于C++实现的(控制台)学校开课查询系统
开发语言·c++
沐欣工作室_lvyiyi1 小时前
基于SpringBoot的博物馆预约系统设计与实现(论文+源码)
java·spring boot·后端·计算机毕业设计