# Ownership & Borrowing (Rust) > ownership のルール、move semantics、borrowing(&T、&mut T)、lifetimes、ダングリング参照 - 22 面接問題 - Junior - [面接問題: Rust](https://sharpskill.dev/ja/technologies/rust/interview-questions.md) ## 1. Rust における ownership とは何ですか? **回答** ownership は Rust の基盤となるシステムで、garbage collector なしでメモリ安全性を保証します。各値には単一の所有者があり、所有者が scope から外れるとメモリは自動的に解放されます。このシステムにより、data races や use-after-free をコンパイル時に防ぐことができます。 ## 2. Rust では、1 つの値はいくつの所有者を持つことができますか? **回答** Rust では、1 つの値は同時に 1 人の所有者しか持つことができません。これが ownership の第一のルールです。ownership が移動(move)されると、以前の所有者はその値にアクセスできなくなります。このルールにより、コードの 2 つの部分が同じメモリを変更したり解放したりすることが決して起こらないことが保証されます。 ## 3. Rustで変数がscopeから外れると何が起こりますか? **回答** 変数がscopeから外れると、Rustは自動的にdrop関数を呼び出してメモリを解放します。この動作は決定的で予測可能であり、メモリを非決定的に解放するgarbage collectorとは異なります。このパターンはRAII(Resource Acquisition Is Initialization)と呼ばれます。 ## さらに19問利用可能 - Rustにおけるmoveとは何ですか? - RustでCopy traitを実装する型はどれですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のRust面接トピック - [Rustの基礎](https://sharpskill.dev/ja/technologies/rust/interview-questions/rust-basics.md): 25問, Junior - [Structs & Enums](https://sharpskill.dev/ja/technologies/rust/interview-questions/structs-enums.md): 20問, Junior - [エラー処理](https://sharpskill.dev/ja/technologies/rust/interview-questions/error-handling.md): 18問, Junior - [コレクション](https://sharpskill.dev/ja/technologies/rust/interview-questions/collections.md): 20問, Junior - [モジュールとパッケージ](https://sharpskill.dev/ja/technologies/rust/interview-questions/modules-packages.md): 18問, Junior - [Traits](https://sharpskill.dev/ja/technologies/rust/interview-questions/traits.md): 22問, Mid-Level - [Generics](https://sharpskill.dev/ja/technologies/rust/interview-questions/generics.md): 20問, Mid-Level - [Lifetimes](https://sharpskill.dev/ja/technologies/rust/interview-questions/lifetimes.md): 20問, Mid-Level - [Iterators & Closures](https://sharpskill.dev/ja/technologies/rust/interview-questions/iterators-closures.md): 22問, Mid-Level - [Smart Pointers](https://sharpskill.dev/ja/technologies/rust/interview-questions/smart-pointers.md): 22問, Mid-Level - [Concurrency Basics](https://sharpskill.dev/ja/technologies/rust/interview-questions/concurrency-basics.md): 20問, Mid-Level - [async/await](https://sharpskill.dev/ja/technologies/rust/interview-questions/async-await.md): 22問, Mid-Level - [Testing](https://sharpskill.dev/ja/technologies/rust/interview-questions/testing.md): 18問, Mid-Level - [Cargo & Ecosystem](https://sharpskill.dev/ja/technologies/rust/interview-questions/cargo-ecosystem.md): 18問, Mid-Level - [Pattern Matching](https://sharpskill.dev/ja/technologies/rust/interview-questions/pattern-matching.md): 18問, Mid-Level - [マクロ](https://sharpskill.dev/ja/technologies/rust/interview-questions/macros.md): 20問, Mid-Level - [Serde とシリアライゼーション](https://sharpskill.dev/ja/technologies/rust/interview-questions/serde-serialization.md): 20問, Mid-Level - [Unsafe Rust](https://sharpskill.dev/ja/technologies/rust/interview-questions/unsafe-rust.md): 20問, Senior - [高度なトレイト](https://sharpskill.dev/ja/technologies/rust/interview-questions/advanced-traits.md): 22問, Senior - [高度な lifetime](https://sharpskill.dev/ja/technologies/rust/interview-questions/advanced-lifetimes.md): 20問, Senior - [Type System](https://sharpskill.dev/ja/technologies/rust/interview-questions/type-system.md): 20問, Senior - [Tokio & Async I/O](https://sharpskill.dev/ja/technologies/rust/interview-questions/tokio-async.md): 22問, Senior - [パフォーマンス最適化](https://sharpskill.dev/ja/technologies/rust/interview-questions/performance-optimization.md): 20問, Senior - [Memory Management](https://sharpskill.dev/ja/technologies/rust/interview-questions/memory-management.md): 20問, Senior - [Web Frameworks](https://sharpskill.dev/ja/technologies/rust/interview-questions/web-frameworks.md): 22問, Senior - [Database Integration](https://sharpskill.dev/ja/technologies/rust/interview-questions/database-integration.md): 20問, Senior - [Rust デザインパターン](https://sharpskill.dev/ja/technologies/rust/interview-questions/design-patterns.md): 20問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/rust/interview-questions/ownership-borrowing