---
title: "Chapter 25: Unsafe Rust and FFI"
description: "The 6 lessons of chapter 25: Unsafe Rust and FFI, in teaching order."
url: "https://learnrust.net/chapter-25/"
last_updated: "2026-06-13"
---

# Chapter 25: Unsafe Rust and FFI

- [25.1 What unsafe actually means](https://learnrust.net/chapter-25/what-unsafe-means.md): The five powers unsafe unlocks, what stays checked even inside unsafe, and the safety-comment culture that treats unsafe as a contract rather than an off-switch.
- [25.2 Raw pointers](https://learnrust.net/chapter-25/raw-pointers.md): The *const T and *mut T raw pointers: how they differ from references, creating them safely, and why dereferencing them requires unsafe.
- [25.3 Unsafe functions and safe abstractions](https://learnrust.net/chapter-25/unsafe-functions-and-safe-abstractions.md): Functions marked unsafe and their preconditions, and the core pattern of wrapping unsafe code in a safe API, with split_at_mut as the example.
- [25.4 Calling C from Rust](https://learnrust.net/chapter-25/calling-c-from-rust.md): Foreign function interface: declaring C functions with extern C, why every foreign call is unsafe, and a real libc example.
- [25.5 Calling Rust from C](https://learnrust.net/chapter-25/calling-rust-from-c.md): Exposing Rust functions to other languages with extern C and no_mangle, building a cdylib, and Rust-in-anything as the closing pitch.
- [25.x Chapter 25 summary and quiz](https://learnrust.net/chapter-25/chapter-25-summary-and-quiz.md): Review of what unsafe means, the five superpowers, raw pointers, safe abstractions, and calling C from Rust and Rust from C.

## Sitemap

See the full [sitemap](https://learnrust.net/sitemap.md) for all pages.
