Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Genel Bakış
Rust, özellikle bellek güvenliğine odaklanan, performans ve güvenliğe yönelik modern bir sistem programlama dilidir. Rust, kritik sistem bileşenlerini geliştirmek için C/C++'a kıyasla daha güvenli bir alternatif olarak Android ekosisteminde giderek daha önemli bir yer edinmektedir. Rust, daha iyi güvenlik ve kararlılık sunar.
Bu sayfa, Android Açık Kaynak Projesi (AOSP) projelerinizde Rust geliştirmeyi desteklemek için Platform için Android Studio'yu (ASfP) kurma konusunda size yol gösterir.
Ön koşullar
ASfP yüklü: ASfP'nin yüklü ve çalışır durumda olduğunu doğrulayın.
Platform ödeme: Makinenizde çalışan bir AOSP platform ödemesi olması gerekir.
Rust desteğini etkinleştirme
ASfP projenizde Rust desteğini etkinleştirmek için adım adım yapmanız gerekenler:
Rust'ı etkinleştirme
Kurulum sihirbazında yeni bir proje oluştururken Rust kutusunu işaretlemeniz yeterlidir:
Yeni proje kurulum sihirbazında Rust onay kutusu.
Mevcut projeler için .asfp-project yapılandırmanıza gidin ve other_languages'ye rust ekleyin:
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>
Projenizi senkronize etme:
Önceki adımları uyguladıktan sonra, tüm değişikliklerin uygulanmasını ve IDE'nin Rust projesini tanımasını sağlamak için proje senkronizasyonunu tetiklemeniz gerekir: Dosya > Projeyi Senkronize Et'e gidin.
Başarıyı doğrulama
Bu adımları tamamladıktan sonra:
Proje görünümünüzde (kaynak iml'nin altında) rust-project.json simgesini görmeniz gerekir. Bu dosya, analiz sırasında Soong tarafından oluşturulur ve LSP'nin dil hizmetleri sağlaması için gerekli olan depo köküne sembolik olarak bağlanır. Bu dosyayı doğrudan düzenlemeyin. Bunun yerine, Soong'un dosyayı işlemesi için yeniden senkronize edin.
rust öğesinin .asfp-project yapılandırmanızdaki other_languages altında bulunduğunu tekrar kontrol etmenizi hatırlatırız.
rust-project.json oluşturulduğundan emin olun.
IDE'nizde Rust'a özgü özelliklerin (aşağıda açıklanmış ve gösterilmiştir) etkinleştirildiğini görmelisiniz.
Önemli Rust IDE özellikleri
Kod tamamlama: Diğer modüllerdeki öğeler de dahil olmak üzere Rust kodu için akıllı öneriler alın.
Farklı bir Rust modülündeki öğeleri öneren kod tamamlama.
Gezinme: Tanımlara hızlıca geçin ve projenizdeki Rust sembollerinin kullanımlarını bulun.
Rust sembolünün tanımına gitme.Rust sembolünün tüm kullanımlarını bulma.
İpuçları: Tür bilgilerini ve dokümanları görmek için sembollerin üzerine gelin.
Başka bir modüldeki Rust sembolü için tür bilgilerini gösteren ipucu.
Yerleştirilmiş ipuçları: Tür bilgilerini ve diğer bağlamsal ipuçlarını doğrudan düzenleyicide görüntüleyin.
Kodun içinde tür bilgilerini gösteren yerleştirilmiş ipuçları.
Yapı görünümü:Yapı araç penceresini (Görünüm > Araç Pencereleri > Yapı) kullanarak Rust dosyalarınızın yapısında gezinin.
Bir Rust dosyasının ana hattını gösteren yapı aracı penceresi.
Yeniden düzenleme: Sembolleri güvenli bir şekilde yeniden adlandırın ve tüm kullanımların güncellenmesini sağlayın.
Rust sembolünü yeniden adlandırma ve tüm referanslarını güncelleme.
Anlık analiz: Rust kodunuzdaki hatalar ve uyarılar hakkında anında geri bildirim alın.
IDE, Rust kodundaki hataları ve uyarıları anlık olarak gösteriyor.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-09-05 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 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"]]