3.5.1 Unsafe Rust 函数
01-Unsafe Rust 函数 — Comprehensive Rust
1分钟内可阅读完
译文 · 基于 Comprehensive Rust
原文链接: https://google.github.io/comprehensive-rust/unsafe-rust/unsafe-functions.html
若函数或方法有额外前置条件,必须由调用方满足才能避免未定义行为,则可将其标记为 unsafe。
Unsafe 函数可能来自两处:
extern "C" 块中的 unsafe 外部函数。讲师备注 接下来我们分别看这两种 unsafe 函数。
01-Unsafe Rust 函数 — Comprehensive Rust
02-Unsafe 外部函数 — Comprehensive Rust
03-调用 Unsafe 函数 — Comprehensive Rust