Unsafe Rust: How and when (not) to use it

By LogRocket Blog - 2021-01-26

Description

Everything you need to know about getting started with unsafe Rust. Learn to troubleshoot common issues and debunk popular myths.

Summary

  • Andre Bogus FollowAndre "llogiq" Bogus is a Rustacean (yes, that's his official title) for Storyscript, a Rust contributor, and Clippy maintainer.
  • This is usually not meant to be used from the outside, but it can sometimes be public because people might use unsafe methods in their code if they want to assume the ensuing responsibility in exchange for performance (or other things).
  • To allow this, Rust has blessed a (unsafe, of course) type with interior mutability — you can get a mutable pointer (not reference, of course) from an immutable borrow using the get(&self) method.
  • All of them are defined as unsafe, mainly because they may not be implemented on your CPU.

 

Topics

  1. Backend (0.33)
  2. Database (0.16)
  3. Security (0.15)

Similar Articles

goldbergyoni/nodebestpractices

By GitHub - 2020-12-19

:white_check_mark: The Node.js best practices list (December 2020) - goldbergyoni/nodebestpractices

CG/SQL: Easy, accurate SQLite code generation

By Facebook Engineering - 2020-10-08

CG/SQL is a code generation system for the popular SQLite library that enables engineers to create complex stored procedures with very large queries.