Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 834 Bytes

File metadata and controls

25 lines (18 loc) · 834 Bytes

L3.7 — Unsafe Rust and FFI for low-level code

Date: 2025-10-04

Author: Community Contributor (placeholder)

Estimated time

45–60 minutes

Objectives

  • Explain when unsafe is required and how to minimize unsafe blocks.
  • Show common FFI patterns when interfacing Rust with C (useful in kernel or driver bindings).
  • Provide safety-checklist for reviewing unsafe code.

Content

  • Primitives of unsafe: dereferencing raw pointers, calling unsafe functions, accessing mutable statics.
  • Examples of wrapping unsafe code in safe abstractions.
  • Using bindgen and cc crate for FFI integration.

Exercises

  • Convert a small piece of unsafe code into a safe wrapper.
  • Use bindgen to generate Rust bindings for a simple C header.

Contributor notes

Placeholder — expand with code examples and references.