# Cargo & Ecosystem (Rust) > คำสั่ง Cargo, dependency, feature, build script, workspace, crates.io, เอกสาร - 18 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: Rust](https://sharpskill.dev/th/technologies/rust/interview-questions.md) ## 1. คำสั่ง Cargo ใดที่คอมไพล์โปรเจกต์โดยไม่สร้างไฟล์ executable สุดท้าย? **คำตอบ** คำสั่ง cargo check คอมไพล์โค้ดเพื่อตรวจสอบข้อผิดพลาดโดยไม่สร้างไบนารีสุดท้าย คำสั่งนี้เร็วกว่า cargo build มากเพราะข้ามขั้นตอนการสร้างโค้ดเครื่อง เหมาะอย่างยิ่งระหว่างการพัฒนาเพื่อตรวจสอบอย่างรวดเร็วว่าโค้ดคอมไพล์ได้อย่างถูกต้อง ## 2. จะระบุ dependency ที่มีเวอร์ชันขั้นต่ำ 1.2.0 แต่ต่ำกว่า 2.0.0 ใน Cargo.toml ได้อย่างไร? **คำตอบ** ไวยากรณ์ serde = "1.2" ใช้การกำหนดเวอร์ชันเชิงความหมายเริ่มต้นของ Cargo ซึ่งหมายความว่า Cargo จะยอมรับเวอร์ชันใด ๆ ที่เข้ากันได้กับ 1.2.0 นั่นคือ >= 1.2.0 และ < 2.0.0 สัญกรณ์นี้เทียบเท่ากับ serde = "^1.2" และเป็นวิธีที่เป็นสำนวนในการระบุ dependency ใน Rust ## 3. ไฟล์ Cargo.lock มีบทบาทอย่างไรในโปรเจกต์ Rust? **คำตอบ** ไฟล์ Cargo.lock บันทึกเวอร์ชันที่แน่นอนของ dependency ทั้งหมดที่ใช้ระหว่างการคอมไพล์สำเร็จครั้งล่าสุด สิ่งนี้รับประกัน build ที่ทำซ้ำได้โดยใช้เวอร์ชันเดียวกันทุกประการบนเครื่องที่ต่างกัน สำหรับไลบรารี ไฟล์นี้มักถูกละเว้นใน git แต่สำหรับไบนารีและแอปพลิเคชัน ควรเก็บไว้ในการควบคุมเวอร์ชัน ## มีอีก 15 คำถาม - จะกำหนด feature ที่เป็นทางเลือกใน Cargo.toml ได้อย่างไร? - ไฟล์ build.rs ที่อยู่ในรากของโปรเจกต์ Cargo มีไว้เพื่ออะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Rust อื่นๆ - [พื้นฐาน Rust](https://sharpskill.dev/th/technologies/rust/interview-questions/rust-basics.md): 25 คำถาม, Junior - [Ownership & Borrowing](https://sharpskill.dev/th/technologies/rust/interview-questions/ownership-borrowing.md): 22 คำถาม, Junior - [Structs & Enums](https://sharpskill.dev/th/technologies/rust/interview-questions/structs-enums.md): 20 คำถาม, Junior - [การจัดการข้อผิดพลาด](https://sharpskill.dev/th/technologies/rust/interview-questions/error-handling.md): 18 คำถาม, Junior - [คอลเลกชัน](https://sharpskill.dev/th/technologies/rust/interview-questions/collections.md): 20 คำถาม, Junior - [โมดูลและแพ็กเกจ](https://sharpskill.dev/th/technologies/rust/interview-questions/modules-packages.md): 18 คำถาม, Junior - [Traits](https://sharpskill.dev/th/technologies/rust/interview-questions/traits.md): 22 คำถาม, Mid-Level - [Generics](https://sharpskill.dev/th/technologies/rust/interview-questions/generics.md): 20 คำถาม, Mid-Level - [Lifetimes](https://sharpskill.dev/th/technologies/rust/interview-questions/lifetimes.md): 20 คำถาม, Mid-Level - [Iterators & Closures](https://sharpskill.dev/th/technologies/rust/interview-questions/iterators-closures.md): 22 คำถาม, Mid-Level - [Smart Pointers](https://sharpskill.dev/th/technologies/rust/interview-questions/smart-pointers.md): 22 คำถาม, Mid-Level - [Concurrency Basics](https://sharpskill.dev/th/technologies/rust/interview-questions/concurrency-basics.md): 20 คำถาม, Mid-Level - [async/await](https://sharpskill.dev/th/technologies/rust/interview-questions/async-await.md): 22 คำถาม, Mid-Level - [Testing](https://sharpskill.dev/th/technologies/rust/interview-questions/testing.md): 18 คำถาม, Mid-Level - [Pattern Matching](https://sharpskill.dev/th/technologies/rust/interview-questions/pattern-matching.md): 18 คำถาม, Mid-Level - [มาโคร](https://sharpskill.dev/th/technologies/rust/interview-questions/macros.md): 20 คำถาม, Mid-Level - [Serde และการ Serialization](https://sharpskill.dev/th/technologies/rust/interview-questions/serde-serialization.md): 20 คำถาม, Mid-Level - [Unsafe Rust](https://sharpskill.dev/th/technologies/rust/interview-questions/unsafe-rust.md): 20 คำถาม, Senior - [Trait ขั้นสูง](https://sharpskill.dev/th/technologies/rust/interview-questions/advanced-traits.md): 22 คำถาม, Senior - [Lifetime ขั้นสูง](https://sharpskill.dev/th/technologies/rust/interview-questions/advanced-lifetimes.md): 20 คำถาม, Senior - [Type System](https://sharpskill.dev/th/technologies/rust/interview-questions/type-system.md): 20 คำถาม, Senior - [Tokio & Async I/O](https://sharpskill.dev/th/technologies/rust/interview-questions/tokio-async.md): 22 คำถาม, Senior - [การเพิ่มประสิทธิภาพ](https://sharpskill.dev/th/technologies/rust/interview-questions/performance-optimization.md): 20 คำถาม, Senior - [Memory Management](https://sharpskill.dev/th/technologies/rust/interview-questions/memory-management.md): 20 คำถาม, Senior - [Web Frameworks](https://sharpskill.dev/th/technologies/rust/interview-questions/web-frameworks.md): 22 คำถาม, Senior - [Database Integration](https://sharpskill.dev/th/technologies/rust/interview-questions/database-integration.md): 20 คำถาม, Senior - [Design Pattern ของ Rust](https://sharpskill.dev/th/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/th/technologies/rust/interview-questions/cargo-ecosystem