Cargo.toml

Overview

This file, Cargo.toml, serves as the manifest for a Rust package named libsqlite3-sys. It specifies the package metadata, dependencies, optional features, and build configuration necessary for compiling and distributing the native bindings to the libsqlite3 library. The file enables Cargo, Rust's package manager and build system, to correctly build, package, and manage this library as part of a larger Rust project or ecosystem.

Package Metadata

The [package] section contains essential metadata describing the crate:

This metadata governs how the crate is identified and handled by Cargo and package registries.

Features

The [features] section declares optional features that can be enabled or disabled by consumers of the crate. Features allow conditional compilation and inclusion of dependencies or functionality:

Usage Example of Features

To enable SQLCipher with vendored OpenSSL at build time, a user may specify:

libsqlite3-sys = { version = "0.35.0", features = ["bundled-sqlcipher-vendored-openssl"] }

This modular feature system allows fine-grained control over binary size, dependencies, and supported SQLite functionality.

Dependencies

The [dependencies] and [build-dependencies] sections list runtime and build-time dependencies respectively.

Runtime Dependencies

Build Dependencies

These dependencies support conditional compilation and building of the crate in various environments and configurations.

Package Metadata for Cargo Machete

The [package.metadata.cargo-machete] section lists dependencies ignored by the cargo-machete tool, which is likely used for dependency analysis or management. It excludes build-time and code-generation related crates such as bindgen, cc, pkg-config, prettyplease, quote, syn, and vcpkg.

Implementation Details and Build Process

Interaction with Other Parts of the System


Mermaid Diagram: Feature and Dependency Flowchart

flowchart TD
A[libsqlite3-sys Package]
A --> B[Features]
B --> B1[default: min_sqlite_version_3_14_0]
B --> B2[bundled]
B --> B3[buildtime_bindgen]
B --> B4[sqlcipher]
B --> B5[loadable_extension]
B2 --> C[cc]
B2 --> D[bundled_bindings]
B4 --> E[bundled-sqlcipher]
E --> F[bundled-sqlcipher-vendored-openssl]
C --> G[build.rs]
F --> H[openssl-sys]
G --> I[bindgen]
G --> J[pkg-config]
G --> K[vcpkg]
B5 --> L[prettyplease]
B5 --> M[quote]
B5 --> N[syn]

This diagram represents the hierarchical relationship between the package, its features, and the dependencies involved in building and enabling various capabilities. It shows how features enable specific dependencies and build-time tools, illustrating the conditional compilation structure defined in the Cargo.toml.