اکوسیستم رراست

اکوسیستم Rust از تعدادی ابزار تشکیل شده است که مهمترین آنها عبارتند از:

  • rustc: کامپایلر Rust که فایل‌های .rs را به باینری و سایر فرمت‌های میانی تبدیل می‌کند.

  • cargo: the Rust dependency manager and build tool. Cargo knows how to download dependencies, usually hosted on https://crates.io, and it will pass them to rustc when building your project. Cargo also comes with a built-in test runner which is used to execute unit tests.

  • rustup: the Rust toolchain installer and updater. This tool is used to install and update rustc and cargo when new versions of Rust are released. In addition, rustup can also download documentation for the standard library. You can have multiple versions of Rust installed at once and rustup will let you switch between them as needed.

نکات کلیدی:

  • Rust یک برنامه سریع برای انتشار نسخه‌های جدید دارد و هر شش هفته یک نسخه جدید منتشر می شود. نسخه‌های جدید سازگاری با نسخه‌های قدیمی را حفظ می‌کنند — به علاوه قابلیت‌های جدید را فعال می‌کنند.

  • سه کانال انتشار وجود دارد: “stable”، “beta”، و “nightly”.

  • ویژگی های جدید در “nightly” آزمایش می شوند ، “beta” چیزی است که هر شش هفته “stable” می شود.

  • Dependencies can also be resolved from alternative registries, git, folders, and more.

  • Rust also has editions: the current edition is Rust 2021. Previous editions were Rust 2015 and Rust 2018.

    • نسخه ها مجاز به ایجاد تغییرات backwards incompatible در زبان هستند.

    • برای جلوگیری از breaking code، نسخه‌ها اختیاری انتخاب می‌شوند که: شما نسخه‌ مورد نظر برای crate خود از طریق فایل Cargo.toml انتخاب می‌کنید.

    • برای جلوگیری از شکاف در اکوسیستم، کامپایلرهای Rust می توانند کدهای نوشته شده برای نسخه های مختلف را ترکیب کنند.

    • لازم به ذکر است که استفاده از کامپایلر به طور مستقیم و نه از طریق cargo بسیار غیرمعمول است (اکثر کاربران هرگز این کار را نمی کنند).

    • It might be worth alluding that Cargo itself is an extremely powerful and comprehensive tool. It is capable of many advanced features including but not limited to:

    • Read more from the official Cargo Book