githubEdit

Cargo.toml

Comprehensive guide to the Cargo.toml manifest for Rust bots and web (site/API) apps on Discloud.

🗂️ What is Cargo.toml?

Cargo.toml is the manifest that defines your Rust package (crate) metadata: name, version, authors, edition, dependencies, features, build scripts and more. Discloud relies on it to resolve and compile your project before starting it.


🛠️ Creating a New Project

1

Initialize in existing directory:

cargo init
2

Create a new directory automatically:

cargo new my_bot
3

Add a dependency quickly (Cargo 1.62+):

cargo add serenity
circle-info

Need Rust? See the installation page.


📦 Examples

Cargo.toml
[package]
name = "discord_bot"
version = "0.1.0"
edition = "2021"

[dependencies]
serenity = { version = "0.11", default-features = false, features = [
	"client", "gateway", "rustls_backend", "model" ] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tracing = "0.1"
dotenvy = "0.15"

Serenity is a Discord API library: https://crates.io/crates/serenityarrow-up-right

circle-info

Need OS-level dependencies (e.g. openssl, ffmpeg)? Add them under APT= in discloud.config. See the APT packages list for syntax and examples.


🧰 Common Commands Reference

Optional tools:

Last updated