संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
खास जानकारी
Rust, सिस्टम प्रोग्रामिंग की एक मॉडर्न भाषा है. यह परफ़ॉर्मेंस और सुरक्षा पर फ़ोकस करती है. खास तौर पर, मेमोरी की सुरक्षा पर. Android के इकोसिस्टम में Rust का इस्तेमाल तेज़ी से बढ़ रहा है. ऐसा इसलिए, क्योंकि यह C/C++ का ज़्यादा सुरक्षित विकल्प है. इसका इस्तेमाल, सिस्टम के अहम कॉम्पोनेंट डेवलप करने के लिए किया जाता है. इससे सुरक्षा और स्थिरता को बेहतर बनाया जा सकता है.
इस पेज पर, Android Studio for Platform (ASfP) को सेट अप करने के बारे में बताया गया है. इससे, Android ओपन सोर्स प्रोजेक्ट (AOSP) में Rust डेवलपमेंट को सपोर्ट किया जा सकता है.
ज़रूरी शर्तें
ASfP इंस्टॉल किया गया है: पुष्टि करें कि आपने ASfP इंस्टॉल किया है और वह काम कर रहा है.
प्लैटफ़ॉर्म चेकआउट: आपके पास मशीन पर काम करने वाला AOSP प्लैटफ़ॉर्म चेकआउट होना चाहिए.
Rust के साथ काम करने की सुविधा चालू करना
यहां सिलसिलेवार तरीके से बताया गया है कि ASfP प्रोजेक्ट में Rust के साथ काम करने की सुविधा कैसे चालू करें:
Rust को चालू करना
सेटअप विज़र्ड में नया प्रोजेक्ट बनाते समय, Rust के लिए दिए गए बॉक्स पर सही का निशान लगाएं:
नए प्रोजेक्ट के सेटअप विज़र्ड में Rust चेकबॉक्स.
मौजूदा प्रोजेक्ट के लिए, अपने .asfp-project कॉन्फ़िगरेशन पर जाएं और other_languages में rust जोड़ें:
other_languages:-cpp-rust```
<figure>
<img src="/studio/platform/images/1-modify_asfp_project_languages.png" alt="Modifying the .asfp-project file to add rust to other_languages" class="screenshot">
<figcaption>Adding Rust support in the <code>.asfp-project</code> file.</figcaption></figure>
अपने प्रोजेक्ट को सिंक करें:
ऊपर दिए गए चरणों को पूरा करने के बाद, आपको प्रोजेक्ट सिंक करना होगा. इससे यह पक्का किया जा सकेगा कि सभी बदलाव लागू हो गए हैं और IDE, Rust प्रोजेक्ट को पहचान रहा है: फ़ाइल > प्रोजेक्ट सिंक करें पर जाएं.
पुष्टि हो गई
यह तरीका अपनाने के बाद:
आपको अपने प्रोजेक्ट व्यू में (सोर्स iml के नीचे) rust-project.json दिखेगा. इस फ़ाइल को Soong, विश्लेषण के दौरान जनरेट करता है. साथ ही, इसे repo रूट से सिंबल लिंक किया जाता है. भाषा से जुड़ी सेवाएं देने के लिए, LSP के लिए यह ज़रूरी है. इस फ़ाइल में सीधे तौर पर बदलाव न करें. इसके बजाय, इसे फिर से सिंक करें, ताकि Soong इसे मैनेज कर सके.
आपको याद दिला दें कि .asfp-project कॉन्फ़िगरेशन में, other_languages के नीचे rust मौजूद है या नहीं.
पक्का करें कि rust-project.json जनरेट हो गया हो.
आपको अपने आईडीई में, Rust से जुड़ी सुविधाएं चालू दिखनी चाहिए. इनके बारे में यहां बताया गया है और इन्हें दिखाया गया है.
Rust IDE की मुख्य सुविधाएं
कोड पूरा करने की सुविधा: Rust कोड के लिए स्मार्ट सुझाव पाएं. इनमें अन्य मॉड्यूल के आइटम भी शामिल हैं.
Code completion suggesting items from a different Rust module.
नेविगेशन: परिभाषाओं पर तुरंत जाएं और अपने प्रोजेक्ट में Rust सिंबल के इस्तेमाल के बारे में जानें.
Rust सिंबल की परिभाषा पर जाना.किसी Rust सिंबल के सभी इस्तेमाल ढूंढना.
टूलटिप: टाइप की जानकारी और दस्तावेज़ देखने के लिए, सिंबल पर कर्सर घुमाएं.
किसी दूसरे मॉड्यूल के Rust सिंबल के टाइप की जानकारी दिखाने वाली टूलटिप.
इनले हिंट: टाइप की जानकारी और अन्य कॉन्टेक्स्ट के हिसाब से हिंट सीधे तौर पर एडिटर में देखें.
कोड में टाइप की जानकारी दिखाने वाले इनले हिंट.
स्ट्रक्चर व्यू:स्ट्रक्चर टूल विंडो (व्यू > टूल विंडो > स्ट्रक्चर) का इस्तेमाल करके, अपनी Rust फ़ाइलों के स्ट्रक्चर पर जाएं.
स्ट्रक्चर टूल विंडो में, Rust फ़ाइल की आउटलाइन दिखाई गई है.
रीफ़ैक्टरिंग: सिंबल का नाम सुरक्षित तरीके से बदला जा सकता है. साथ ही, उनके सभी इस्तेमाल अपडेट किए जा सकते हैं.
किसी रस्ट सिंबल का नाम बदलना और उसके सभी रेफ़रंस अपडेट करना.
रीयल-टाइम में विश्लेषण: अपने Rust कोड में गड़बड़ियों और चेतावनियों के बारे में तुरंत फ़ीडबैक पाएं.
आईडीई, Rust कोड में रीयल-टाइम में गड़बड़ियां और चेतावनियां दिखा रहा है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-09-05 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-09-05 (UTC) को अपडेट किया गया."],[],[],null,["Overview\n\nRust is a modern systems programming language focused on performance and safety,\nparticularly memory safety. Rust is increasingly important in the Android\necosystem as a safer alternative to C/C++ for developing critical system\ncomponents, offering improved security and stability.\n\nThis page guides you through setting up Android Studio for Platform (ASfP) to\nsupport Rust development within your Android Open Source Project (AOSP)\nprojects.\n\nPrerequisites\n\n- **ASfP Installed:** Verify you have ASfP installed and running.\n- **Platform checkout:** You need a working AOSP platform checkout on your machine.\n\nEnabling Rust support\n\nHere's the step-by-step process to get Rust support working in your ASfP\nproject:\n\n1. **Enable Rust**\n\n - When creating a **new project** in the setup wizard, simply check the box for Rust:\n\n Rust checkbox in new project setup wizard.\n - For existing projects, navigate to your `.asfp-project` config and add `rust` to `other_languages`:\n\n other_languages:\n - cpp\n - rust\n ```\n\n \u003cfigure\u003e\n \u003cimg src=\"/studio/platform/images/1-modify_asfp_project_languages.png\" alt=\"Modifying the .asfp-project file to add rust to other_languages\" class=\"screenshot\"\u003e\n \u003cfigcaption\u003eAdding Rust support in the \u003ccode\u003e.asfp-project\u003c/code\u003e file.\u003c/figcaption\u003e\n \u003c/figure\u003e\n\n\u003c!-- --\u003e\n\n1. **Sync your project:**\n\n - After performing the previous steps, you need to trigger a project sync to ensure that all changes are applied and the IDE recognizes the Rust project: Go to **File \\\u003e Sync Project**.\n\nVerifying success\n\nAfter completing these steps:\n\n- You should see `rust-project.json` in your project view (under the source\n iml). This file is generated by Soong during analysis and symlinked to the\n repo root, which is necessary for LSP to provide language services. **DO\n NOT** edit this file directly; instead, re-sync to let Soong handle it.\n\n As a reminder, double check that `rust` is present under `other_languages`\n in your `.asfp-project` config.\n Ensure that `rust-project.json` has been generated.\n- You should see Rust-specific features (described and shown below) enabled in\n your IDE.\n\nKey Rust IDE features\n\n- **Code completion:** Get intelligent suggestions for Rust code, including\n items from other modules.\n\n Code completion suggesting items from a different Rust module.\n\n \u003cbr /\u003e\n\n- **Navigation:** Quickly jump to definitions and find usages of Rust symbols\n across your project.\n\n Navigating to the definition of a Rust symbol. Finding all usages of a Rust symbol.\n\n \u003cbr /\u003e\n\n- **Tooltips:** Hover over symbols to see type information and documentation.\n\n Tooltip showing type information for a Rust symbol from another module.\n\n \u003cbr /\u003e\n\n- **Inlay hints:** View type information and other contextual hints directly\n in the editor.\n\n Inlay hints showing type information within the code.\n\n \u003cbr /\u003e\n\n- **Structure view:** Navigate the structure of your Rust files using the\n **Structure** tool window (View \\\u003e Tool Windows \\\u003e Structure).\n\n The structure tool window showing the outline of a Rust file.\n\n \u003cbr /\u003e\n\n- **Refactoring:** Safely rename symbols and have all usages updated.\n\n Renaming a Rust symbol and updating all its references.\n\n \u003cbr /\u003e\n\n- **Real-time analysis:** Get instant feedback on errors and warnings in your\n Rust code.\n\n IDE showing real-time errors and warnings in Rust code.\n\n \u003cbr /\u003e"]]