Rustup से Rust Install करना
In this page:
Installing Rustup
Rustup Rust install और manage करने का official तरीका है।
Linux और macOS पर, आप एक single shell command चलाते हैं जो rustup installer download और run करता है, जो फिर rustc compiler, cargo build tool, और standard library install करता है।
source $HOME/.cargo/env चलाएं ताकि नए commands आपके PATH पर हों।उदाहरण: Installing Rustup
# Linux/macOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Windows
# Download and run rustup-init.exe from https://rustup.rs
⚠️ Run this in your own terminal or Node.js environment.
Checking the Installed Version
एक बार install होने के बाद, आप compiler और Cargo build tool से उनके version numbers पूछकर confirm कर सकते हैं कि Rust तैयार है। कोई code लिखने से पहले यह जांचने का सबसे तेज़ तरीका है कि install काम कर गया।
उदाहरण: Checking the Installed Version
rustc --version
cargo --version
⚠️ Run this in your own terminal or Node.js environment.
Updating Rust
Rust हर लगभग छह हफ्तों में नई stable releases ship करता है। rustup update latest stable toolchain fetch करता है ताकि आपके पास हमेशा current compiler features और standard library additions हों।
उदाहरण: Updating Rust
rustup update stable
⚠️ Run this in your own terminal or Node.js environment.
Confirming From Inside a Program
आप एक असली Rust program compile और run करके भी verify कर सकते हैं कि आपकी toolchain end-to-end काम करती है। अगर यह सही print करे, तो आपकी installation पूरी और functional है।
उदाहरण: Confirming From Inside a Program
// Entry point: execution of the program starts here
fn main() {
// Print "Rust toolchain is installed and working!" to the console (with a trailing newline)
println!("Rust toolchain is installed and working!");
}
Login to try C/C++/Java/PHP code in the editor
- rustup उपयोग करने के बजाय एक system package manager से Rust install करने की कोशिश करना और इसके बजाय एक पुराना version पाना।
- terminal restart (या shell profile reload) करना भूल जाना, जिससे
cargoऔरrustccommands नहीं मिलते। - समय-समय पर
rustup updateन चलाना, जो आपको एक पुराने compiler पर छोड़ देता है जिसमें नए language features नहीं हैं।
- Rustup Rust के लिए official installer और version manager है, जो rustc, cargo, और standard tooling cover करता है।
- Linux/macOS पर आप rust-lang.org से एक shell script चलाकर इसे install करते हैं; Windows पर एक dedicated installer है।
rustup updateआपकी toolchain को current रखता है, औरrustup showदिखाता है कि क्या installed है।- Installation के बाद,
rustc --versionऔरcargo --versionconfirm करते हैं कि सब कुछ काम कर रहा है।
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: