Aporiae

What Makes Rust Safe?

How does Rust guarantee memory safety? That answer eluded me until I read about the concepts of ownership, borrowing, and slices. Ownership is a method for managing heap data sans a garbage collector. Borrowing is the Rustacean term for creating and using references. And you’ve probably heard of slices before. Rust treats slices as a special kind of reference – one to some contiguous sequence of elements. Together, these three concepts give you memory safety without sacrificing control over memory usage:

Understanding Ownership - The Rust Programming Language

#programming #rust #safety