Cargo.toml

Overview

Cargo.toml is the manifest file for the transport-layer Rust package. It defines package metadata, dependencies, development dependencies, build instructions, and workspace-related configurations. This file governs how the Rust package is built, which external libraries it requires, and metadata about the package, ensuring consistent builds and dependency resolution.


File Sections and Their Purpose

[package]

[dependencies]

Lists runtime dependencies required by the transport-layer package. Dependencies are either specified with explicit versions, workspace references, or git sources. Key points:

[dev-dependencies]

Dependencies used only during development and testing:

[package.metadata.cargo-machete]


Implementation Details and Algorithms


Interactions with Other System Components


Visual Diagram: Dependency Structure Overview

flowchart TD
A[transport-layer] --> B[build.rs]
A --> C[workspace dependencies]
A --> D[versioned crates]
A --> E[git dependency msquic]
C --> F(anyhow)
C --> G(async-trait)
C --> H(futures)
C --> I(quinn)
C --> J(rustls)
C --> K(serde_json)
D --> L(bytes)
D --> M(cbc)
D --> N(cipher)
D --> O(des)
D --> P(ed25519-dalek)
D --> Q(sha1)
D --> R(sha2)
D --> S(x509-parser)
E --> T(msquic)
A --> U[dev-dependencies]
U --> V(once_cell)
U --> W(tracing-subscriber)

The diagram represents how the transport-layer package depends on:


Usage Examples

Since Cargo.toml is a configuration file for Rust's package manager, it is not directly invoked in code but controls how the package is built and which dependencies are available. Example workflows:

For further understanding of dependency management, refer to [Cargo package management](/cargo-package-management).


Notes on Workspace Usage

The .workspace = true flags in this file mean that many versions and configurations are centralized at the workspace level. This promotes consistency across related packages in the codebase, as versions and features are controlled uniformly.

For details on workspace management, see [Rust workspace configuration](/rust-workspace-configuration).