一个使用 Rust 类型编程实现更安全编程的完美例子,可仔细阅读。
Using Type-Level Programming in Rust to Make Safer Hardware Abstractions
n the world of systems programming where one may find themselves writing hardware drivers or interacting directly with memory-mapped devices, that interaction is almost always through memory-mapped registers provided by the hardware. We typically interact with these things through bitwise operations on some fixed-width numeric type.
For instance, imagine an 8-bit register with three fields:
Ext Link: https://blog.auxon.io/2019/10/25/type-level-registers/
1
共 0 条评论, 1 页
评论区
写评论还没有评论