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
相关推荐
niaiheni14 小时前
PHP文件包含
开发语言·php
初次见面我叫泰隆14 小时前
Qt——1、初识Qt
开发语言·c++·qt
Arms20614 小时前
python时区库学习
开发语言·python·学习
短剑重铸之日14 小时前
《7天学会Redis》特别篇: Redis分布式锁
java·redis·分布式·后端·缓存·redission·看门狗机制
无名的小三轮14 小时前
第二章 信息安全概述
开发语言·php
清水白石00814 小时前
深入 Python 对象模型:PyObject 与 PyVarObject 全解析
开发语言·python
独自破碎E15 小时前
说说Java中的反射机制
java·开发语言
一直都在57215 小时前
SpringBoot3 框架快速搭建与项目工程详解
java·开发语言
子云之风15 小时前
LSPosed 项目编译问题解决方案
java·开发语言·python·学习·android studio
小北方城市网15 小时前
SpringBoot 全局异常处理与接口规范实战:打造健壮可维护接口
java·spring boot·redis·后端·python·spring·缓存