50% off tất cả các gói, thời gian có hạn. Bắt đầu từ $2.48/mo
Rust

Rust

Rust là ngôn ngữ lập trình hệ thống. An toàn bộ nhớ, không có garbage collector, nhanh ngang C, và là ngôn ngữ được yêu thích nhất tám năm liên tiếp trên Stack Overflow. Được dùng tại AWS, Microsoft, Cloudflare, Discord và nhân Linux. Lựa chọn mặc định mới cho phần mềm hệ thống hiệu năng cao.

Version

Latest

Operating System

Ubuntu Server 24.04 LTS

Min. RAM

1 GB

IP Types

IPV4,IPV6

Access

Credentials:

  • User: ferris
  • Password: (stored in /root/.cloudzy-creds)

SSH vào server với quyền root, sau đó chuyển sang người dùng Rust:

su - ferris

Important Directories

  • /home/ferris/.cargo/ → Cargo binaries (cargo, installed crates)
  • /home/ferris/.rustup/ → Toolchain & các thành phần Rust
  • /home/ferris/ → Workspace của bạn (các project đặt ở đây)

Useful Commands

Verify installation:

cargo --version
rustc --version

Update Rust:

rustup update

Thêm/Cập nhật công cụ bổ sung (ví dụ: linter):

rustup component add clippy

Uninstall Rust:

rustup self uninstall

Build project của bạn:

cargo build

Chạy project của bạn:

cargo run

Run tests:

cargo test

Build tài liệu cho project của bạn:

cargo doc --open

Xuất bản thư viện lên crates.io:

cargo publish

Một Ứng Dụng Rust Nhỏ

Tạo dự án mới:

cargo new hello-rust
cd hello-rust

Chạy chương trình mặc định:

cargo run

Thêm dependency qua CLI:

cargo add ferris-says

Sau đó build (Cargo sẽ tự cài dependency cho bạn):

cargo build

Lệnh này cũng sẽ tạo ra Cargo.lock (file khóa phiên bản dependency).

Edit src/main.rs:

use ferris_says::say;
use std::io::{stdout, BufWriter};


fn main() {
    let stdout = stdout();
    let message = String::from("Hello fellow Rustaceans!");
    let width = message.chars().count();


    let mut writer = BufWriter::new(stdout.lock());
    say(&message, width, &mut writer).unwrap();
}

Run it:

cargo run

Thêm trong Công cụ Phát triển

Related apps.

Triển khai Rust ngay. From $2.48/mo.