์†Œ์œ ๊ถŒ

๋ชจ๋“  ๋ณ€์ˆ˜ ๋ฐ”์ธ๋”ฉ์€ ์œ ํšจํ•œ โ€œ๋ฒ”์œ„(์Šค์ฝ”ํ”„)โ€œ๋ฅผ ๊ฐ€์ง€๋ฉฐ, ๋ฒ”์œ„ ๋ฐ–์—์„œ ๋ณ€์ˆ˜ ์‚ฌ์šฉํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค:

struct Point(i32, i32);

fn main() {
    {
        let p = Point(3, 4);
        println!("x: {}", p.0);
    }
    println!("y: {}", p.1);
}

We say that the variable owns the value. Every Rust value has precisely one owner at all times.

At the end of the scope, the variable is dropped and the data is freed. A destructor can run here to free up resources.

This slide should take about 5 minutes.

๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜ ๊ตฌํ˜„์— ์ต์ˆ™ํ•œ ํ•™์ƒ์€ ๊ฐ€๋น„์ง€ ์ปฌ๋ ‰ํ„ฐ๊ฐ€ ์—ฐ๊ฒฐ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด โ€˜๋ฃจํŠธโ€™ ์„ธํŠธ๋กœ ์‹œ์ž‘ํ•œ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. Rust์˜ โ€˜๋‹จ์ผ ์†Œ์œ ์žโ€™ ์›์น™๋„ ์ด์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค.