Chapter 5
Ownership & Memory Safety
Ownership is Blyx’s most unique feature and enables memory safety guarantees without needing a garbage collector.
Ownership Rules
- Each value in Blyx has an owner.
- There can only be one owner at a time.
- When the owner goes out of scope, the value is dropped automatically.
let s1 = String::from("hello");
let s2 = s1; // s1 ownership moves to s2
// s1 is no longer valid here